选项卡

例子

选项卡 - 图1

  1. <avue-tabs :option="option" @change="change">
  2. <template slot="before">
  3. <el-tag>卡槽头部{{type}}</el-tag>
  4. </template>
  5. <template slot="user">
  6. <avue-crud :option="item.option" :data="data"></avue-crud>
  7. </template>
  8. <template slot="shanghu">
  9. <avue-form :option="item.option" v-model="form"></avue-form>
  10. </template>
  11. <template slot="weixin">
  12. <avue-form :option="item.option" v-model="form"></avue-form>
  13. </template>
  14. <template slot="qq">
  15. <avue-form :option="item.option" v-model="form"></avue-form>
  16. </template>
  17. <template slot="after">
  18. <el-tag>卡槽尾部{{type}}</el-tag>
  19. </template>
  20. </avue-tabs>
  21. <script>
  22. export default {
  23. data() {
  24. return {
  25. type:0,
  26. item:{},
  27. form:{},
  28. data:[
  29. {
  30. username:'smallwei',
  31. password:123456,
  32. type:123
  33. },
  34. {
  35. username:'avue',
  36. password:123456,
  37. type:123
  38. }
  39. ],
  40. option:{
  41. column: [{
  42. label: '用户信息',
  43. prop: 'user',
  44. icon: 'el-icon-date',
  45. option: {
  46. page:false,
  47. menuWidth:300,
  48. column: [{
  49. label: "用户名",
  50. prop: "username",
  51. rules: [{
  52. required: true,
  53. message: "请输入用户名",
  54. trigger: "blur"
  55. }],
  56. },{
  57. label: "密码",
  58. prop: "password",
  59. type:'password'
  60. },{
  61. label: "自定义字段",
  62. prop: "type",
  63. type:'type',
  64. solt:true
  65. }
  66. ]
  67. }
  68. }, {
  69. label: '商户信息',
  70. prop: 'shanghu',
  71. icon: 'el-icon-picture',
  72. option: {
  73. submitText: '完成',
  74. column: [{
  75. label: "商户名称",
  76. prop: "owName",
  77. rules: [{
  78. required: true,
  79. message: "请输入商户名称",
  80. trigger: "blur"
  81. }],
  82. }]
  83. }
  84. }, {
  85. label: '微信信息',
  86. prop: 'weixin',
  87. icon: 'el-icon-picture-outline',
  88. option: {
  89. submitText: '完成',
  90. column: [{
  91. label: "微信名称",
  92. prop: "weixinName",
  93. rules: [{
  94. required: true,
  95. message: "请输入微信名称",
  96. trigger: "blur"
  97. }],
  98. }]
  99. }
  100. }, {
  101. label: 'QQ信息',
  102. prop: 'qq',
  103. disabled: true,
  104. icon: 'el-icon-share',
  105. option: {
  106. submitText: '完成',
  107. column: [{
  108. label: "QQ名称",
  109. prop: "qqName",
  110. rules: [{
  111. required: true,
  112. message: "请输入QQ名称",
  113. trigger: "blur"
  114. }],
  115. }]
  116. }
  117. }]
  118. }
  119. }
  120. },
  121. methods: {
  122. change (item) {
  123. this.type = item.prop
  124. this.item = item;
  125. this.$message.success('当前选项卡对象'+JSON.stringify(item))
  126. },
  127. }
  128. }
  129. </script>

Avue-tabs Option Attributes

参数说明类型可选值默认值
label选项卡显示名称String--
prop选项卡别名String--
description选项卡描述String--
icon选项卡图标String--

Avue-tabs Events

事件名说明参数
change返回当前选项卡的整体对象item

Avue-tabs Methods

方法名说明参数
changeTabs传入标签的序号即可切换active

Avue-tabs Scoped Slot

name说明
after内容之前的卡槽
brfore内容之后的卡槽
说明每个选项卡的卡槽