VUE项目中使用this.$forceUpdate()

原创 yxchun 随笔 随笔 115阅读 2019-03-26 11:54:11 举报

<Dropdown trigger="custom" @on-clickoutside="visible=false" :visible="visible" placement="bottom-end"
style="margin-left: 70px">
<Button @click.stop="visible=true" icon="md-add">新增保养人员</Button>
<DropdownMenu slot="list">
<p v-for="(item,index) in directoryList" @click.stop="selectPeople(item,index)" :key="index" class="list-item">
<span>{{item.Name}}</span>
<Icon v-if="item.select" color="#2d8cf0" size="24" type="ios-checkmark" />
</p>
</DropdownMenu>
</Dropdown>

selectPeople(item,index) {//选中人员
if(item.select){
this.directoryList[index].select=false
}else{
this.directoryList[index].select=true
}
this.$forceUpdate();
},

用set方法不生效,最后发现$forceUpdate()

评论 ( 0 )
最新评论
暂无评论

赶紧努力消灭 0 回复