Vue 中的Element-ui 组件el-checkbox动态赋值的问题
vue中修改checkbox的选中状态是不会实时更新的。看到一个方法,亲测有效。加个v-if=‘table’ ,重新渲染一下表格就好了

<el-table :data="sceneData"  v-if="table">
        <el-table-column prop="name" label="功能"></el-table-column>
        <el-table-column label="触发条件" label-class-name="scene-condition">
          <template slot-scope="scope">
            <el-checkbox :checked="scope.row.scenes.trigger==1"  v-model="scope.row.scenes.trigger"></el-checkbox>
          </template>
        </el-table-column>
        <el-table-column label="执行任务" label-class-name="scene-condition">
          <template slot-scope="scope">
            <el-checkbox :checked="scope.row.scenes.execute==1"  v-model="scope.row.scenes.execute"></el-checkbox>
          </template>
        </el-table-column>
</el-table>
.....
    sceneDevice:function(){
      let This=this;
      This.table = false;
      This.sceneDialogVisible=true;
       let data = {
        product_id: This.productId
      };
      axios.post(getproductscenes, data).then(res => {
        if (res.status == '0') {
          This.sceneData=res.result.data.functions;
          This.table = true;
        }
      });
    },
GitHub 加速计划 / eleme / element
54.06 K
14.63 K
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:2 个月前 )
c345bb45 6 个月前
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 6 个月前
Logo

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

更多推荐