Commit 9b6f316e47de169c6642db14db8d3d2338d7700d

Authored by 梁灏
1 parent 7b0fb4ef

fixed Tabs bug

Showing 2 changed files with 10 additions and 24 deletions   Show diff stats
examples/routers/tabs.vue
... ... @@ -158,38 +158,24 @@
158 158 <!--</script>-->
159 159  
160 160 <template>
161   - <div>
162   - <Button type="primary" @click="modal1 = true">显示对话框</Button>
163   - <Modal
164   - v-model="modal1"
165   - title="普通的Modal对话框标题"
166   - @on-ok="ok"
167   - @on-cancel="cancel">
168   - <p>对话框内容</p>
169   - <p>对话框内容</p>
170   - <p>对话框内容</p>
171   - <Tabs value="name1">
172   - <TabPane label="标签一" name="name1">标签一的内容</TabPane>
173   - <TabPane label="标签二" name="name2">标签二的内容</TabPane>
174   - <TabPane label="标签三" name="name3">标签三的内容</TabPane>
175   - </Tabs>
176   - </Modal>
177   - </div>
  161 + <Tabs type="card">
  162 + <TabPane v-for="tab in tabs" :key="tab" :label="'标签' + tab">标签{{ tab }}</TabPane>
  163 + <Button type="ghost" @click="handleTabsAdd" size="small" slot="extra">增加</Button>
  164 + </Tabs>
178 165 </template>
179 166 <script>
180 167 export default {
181 168 data () {
182 169 return {
183   - modal1: false
  170 + tabs: 2
184 171 }
185 172 },
186 173 methods: {
187   - ok () {
188   - this.$Message.info('点击了确定');
189   - },
190   - cancel () {
191   - this.$Message.info('点击了取消');
  174 + handleTabsAdd () {
  175 + this.tabs ++;
192 176 }
193 177 }
194 178 }
195 179 </script>
  180 +
  181 +
... ...
src/components/tabs/tabs.vue
... ... @@ -354,7 +354,7 @@
354 354 },
355 355 beforeDestroy() {
356 356 this.observer.removeListener(this.$refs.navWrap, this.handleResize);
357   - this.mutationObserver.disconnect();
  357 + if (this.mutationObserver) this.mutationObserver.disconnect();
358 358 }
359 359 };
360 360 </script>
... ...