Commit c953c652 authored by JingChao's avatar JingChao

stab

parent d66af184
...@@ -14,6 +14,10 @@ export default { ...@@ -14,6 +14,10 @@ export default {
mixins: [base], mixins: [base],
component: { stabItem }, component: { stabItem },
props: { props: {
value: {
type: Number,
default: 0,
},
position: { position: {
type: String, type: String,
default: 'top', default: 'top',
...@@ -73,13 +77,23 @@ export default { ...@@ -73,13 +77,23 @@ export default {
} }
}, },
}, },
watch: {
value (value) {
if (value > this.count - 1) {
throw 'tab index out of bound exception'
} else {
this.defaultActive === value
this.setTabActive(value)
}
},
},
mounted () { mounted () {
let vm = this let vm = this
setTimeout(() => { if (vm.value > vm.count - 1) {
this.items[vm.current].$el.classList.add('activated') throw 'tab index out of bound exception'
}, 100) } else {
this.$emit('input', vm.current) vm.setTabActive(vm.value)
this.scrollToActiveTab(vm.current, this.items[vm.current].$el.clientWidth) }
}, },
methods: { methods: {
setTabActive (index) { setTabActive (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