由于业务需求,需要在页面上使用element-ui的select多选框的方法,当select为空时,change事件和remove-tag事件可以完美呈现,但是当select中赋值后,change事件和remove-tag事件可以触发,但是页面上没有反应。

<el-select v-model="debt.borrowers" filterable multiple placeholder="可直接搜索、多选" @change="change">
   <el-option v-for="item in borrowerOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>

此时,应当在change事件中添加一个VUE本身的$forceUpdate方法进行强制渲染。

change () {
  this.$forceUpdate()
},

 

GitHub 加速计划 / eleme / element
54.06 K
14.63 K
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:1 个月前 )
c345bb45 5 个月前
a07f3a59 * Update transition.md * Update table.md * Update transition.md * Update table.md * Update transition.md * Update table.md * Update table.md * Update transition.md * Update popover.md 5 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐