Commit f85c8bdf authored by JingChao's avatar JingChao

tab添加切换活跃的函数

parent 2b461f12
......@@ -78,9 +78,21 @@ export default {
setTimeout(() => {
this.items[vm.current].$el.classList.add('activated')
}, 100)
this.$emit('input', vm.current)
this.scrollToActiveTab(vm.current, this.items[vm.current].$el.clientWidth)
},
methods: {
setTabActive (index) {
let vm = this
vm.items.forEach(item => {
item.$el.classList.remove('activated')
})
setTimeout(() => {
this.items[index].$el.classList.add('activated')
}, 100)
let width = this.items[index].$el.clientWidth
this.actived(index, width)
},
actived (index, clientWidth) {
this.activedIndex = index
this.$emit('tabClick', index)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment