|
35 | 35 | tabs: [{ |
36 | 36 | label: 'Home', |
37 | 37 | icon: 'cubeic-home' |
38 | | - }, { |
| 38 | + }, { |
39 | 39 | label: 'Like', |
40 | 40 | icon: 'cubeic-like' |
41 | | - }, { |
| 41 | + }, { |
42 | 42 | label: 'Vip', |
43 | 43 | icon: 'cubeic-vip' |
44 | | - }, { |
| 44 | + }, { |
45 | 45 | label: 'Me', |
46 | 46 | icon: 'cubeic-person' |
47 | 47 | }] |
48 | 48 | } |
49 | 49 | }, |
50 | 50 | methods: { |
51 | 51 | clickHandler (label) { |
52 | | - // if you clicked home tab, then print 'Home' |
| 52 | + // if you clicked home tab, then print 'Home' |
53 | 53 | console.log(label) |
54 | 54 | }, |
55 | 55 | changeHandler (label) { |
56 | | - // if you clicked different tab, this methods can be emitted |
| 56 | + // if you clicked different tab, this methods can be emitted |
57 | 57 | } |
58 | 58 | } |
59 | 59 | } |
|
71 | 71 | showSlider |
72 | 72 | inline |
73 | 73 | @click="clickHandler"> |
74 | | - <cube-tab v-for="(item, index) in tabs" :label="item.label" :key="item.label"> |
| 74 | + <cube-tab v-for="(item, index) in tabs" :label="item.label" :key="item.label"> |
75 | 75 | <!-- name为icon的插槽 --> |
76 | 76 | <i slot="icon" :class="item.icon"></i> |
77 | 77 | <!-- 默认插槽 --> |
|
87 | 87 | return { |
88 | 88 | selectedLabelSlots: 'Like' |
89 | 89 | tabs: [{ |
90 | | - label: 'Home', |
| 90 | + label: 'Home', |
91 | 91 | icon: 'cubeic-home' |
92 | | - }, { |
93 | | - label: 'Like', |
| 92 | + }, { |
| 93 | + label: 'Like', |
94 | 94 | icon: 'cubeic-like' |
95 | | - }, { |
96 | | - label: 'Vip', |
| 95 | + }, { |
| 96 | + label: 'Vip', |
97 | 97 | icon: 'cubeic-vip' |
98 | | - }, { |
99 | | - label: 'Me', |
| 98 | + }, { |
| 99 | + label: 'Me', |
100 | 100 | icon: 'cubeic-person' |
101 | 101 | }] |
102 | 102 | } |
103 | 103 | }, |
104 | 104 | methods: { |
105 | 105 | clickHandler (label) { |
106 | | - // if you clicked home tab, then print 'Home' |
| 106 | + // if you clicked home tab, then print 'Home' |
107 | 107 | console.log(label) |
108 | 108 | } |
109 | 109 | } |
|
118 | 118 | ```html |
119 | 119 | <template> |
120 | 120 | <cube-tab-bar v-model="selectedLabel" showSlider> |
121 | | - <cube-tab v-for="(item, index) in tabs" :icon="item.icon" :label="item.label" :key="item.label"> |
| 121 | + <cube-tab v-for="(item, index) in tabs" :icon="item.icon" :label="item.label" :key="item.label"> |
122 | 122 | </cube-tab> |
123 | 123 | </cube-tab-bar> |
124 | 124 | <cube-tab-panels v-model="selectedLabel"> |
125 | | - <cube-tab-panel v-for="(item, index) in tabs" :label="item.label" :key="item.label"> |
| 125 | + <cube-tab-panel v-for="(item, index) in tabs" :label="item.label" :key="item.label"> |
126 | 126 | <ul> |
127 | | - <li class="tab-panel-li" v-for="(hero, index) in item.heroes"> |
| 127 | + <li class="tab-panel-li" v-for="(hero, index) in item.heroes"> |
128 | 128 | {{hero}} |
129 | 129 | </li> |
130 | 130 | </ul> |
|
137 | 137 | export default { |
138 | 138 | data () { |
139 | 139 | return { |
140 | | - selectedLabel: '天辉', |
| 140 | + selectedLabel: '天辉', |
141 | 141 | tabs: [{ |
142 | | - label: '天辉', |
143 | | - icon: 'cubeic-like', |
144 | | - heroes: ['敌法师', '卓尔游侠', '主宰', '米拉娜', '变体精灵', '幻影长矛手', '复仇之魂', '力丸', '矮人狙击手', '圣堂刺客', '露娜', '赏金猎人', '熊战士'] |
145 | | - }, { |
146 | | - label: '夜魇', |
147 | | - icon: 'cubeic-star', |
148 | | - heroes: ['血魔', '影魔', '剃刀', '剧毒术士', '虚空假面', '幻影刺客', '冥界亚龙', '克林克兹', '育母蜘蛛', '编织者', '幽鬼', '司夜刺客', '米波'] |
| 142 | + label: '天辉', |
| 143 | + icon: 'cubeic-like', |
| 144 | + heroes: ['敌法师', '卓尔游侠', '主宰', '米拉娜', '变体精灵', '幻影长矛手', '复仇之魂', '力丸', '矮人狙击手', '圣堂刺客', '露娜', '赏金猎人', '熊战士'] |
| 145 | + }, { |
| 146 | + label: '夜魇', |
| 147 | + icon: 'cubeic-star', |
| 148 | + heroes: ['血魔', '影魔', '剃刀', '剧毒术士', '虚空假面', '幻影刺客', '冥界亚龙', '克林克兹', '育母蜘蛛', '编织者', '幽鬼', '司夜刺客', '米波'] |
149 | 149 | }] |
150 | 150 | } |
151 | 151 | } |
|
0 commit comments