雙向綁定失效,效果是點(diǎn)擊html里面的 i 標(biāo)簽(位置請(qǐng)看注釋)觸發(fā)方法,將collapse-transition組件里的v-show屬性改為true,控制組件展開,問題是組件里有個(gè)me屬相,如果把頁(yè)面里的{{me}}刪掉的話,組件就無(wú)法展開(相對(duì)應(yīng)的v-show屬性已經(jīng)改為true,單頁(yè)面中display仍為node),加上就可以這是為什么?<style scoped>.transfer-box{ width: 500px; >div{ width: 220px; height: 400px; border: 1px solid #c1c1c1; position: relative; font-size: 12px; line-height: 30px; .transfer-control-title{ height: 30px; background: #e9e9e9; line-height: 30px; padding: 0 5px; position: absolute; width: 100%; box-sizing: border-box; } .transfer-choose-box{ margin-top: 30px; height: 361px; overflow-y: auto; .parent-muen{ >.parent-muen-item{ .sub-muen{ margin-left: 30px; } } } } }}methods: { //根據(jù)生命周期里生成的不變量數(shù)組,切換菜單展開狀態(tài) toggleSubCollapse(key){ this.me++; this.showSubList['show'+key] = !this.showSubList['show'+key] } }, created() { //對(duì)獲取的數(shù)據(jù)遍歷,生成控制列表展開的對(duì)象 Object.keys(this.industryList).forEach((val, index, arr)=>{ this.showSubList['show'+val] = false; }) }, mounted() { }};</script>
vue 雙向綁定失效
三國(guó)紛爭(zhēng)
2019-03-06 10:15:08