Vue.component("more-btn", { template: `
{{text}}
`, props: { label: { type: String }, nav: { type: String }, list: { type: Array }, }, data() { return { show: false, widths: 0, btnNav: -1, chooseMenu: {}, text:'' } }, mounted() { this.text = this.label this.init() }, methods: { init() { this.width() }, width() { if (this.list) { if (this.list.length > 4) { this.widths = 616 } else { this.widths = this.list.length * 150 + 16 } } }, buttonClick(i, item) { this.btnNav = i this.text = item.text this.$emit('value',item); }, mouseenterBtn() { this.show = true }, mouseleaveBtn() { this.show = false } }, watch: { nav:function (n,o) { this.nav=n if(n == ''){ this.btnNav = -1 } } }, })