vue 作用于插槽 (我都不懂了)

子组件

<!-- 插槽列------禁止启用状态 -->
      <el-table-column  v-if="item.columnType==='slot'" :key="item.prop" :prop="item.prop" :label="item.label" :width="item.width">
        <template slot-scope="scope">    //凡是template必须写  slot-scope="scope"
          <slot :name="item.slotName" :data="scope.row"></slot>
        </template>
      </el-table-column>
<!-- 插槽列------禁止启用状态END -->

父组件

<tableVue :configTable="data.configTable" >
    <template slot="status" slot-scope="scope"  >  //凡是template必须写  slot-scope="scope"
      {{scope.data.name}}
      <!-- v-slot:status="item" -->   
        <el-switch
          active-color="#13ce66"
          inactive-color="#ff4949">
        </el-switch>
    </template>
  </tableVue>

猜你喜欢

转载自www.cnblogs.com/maizilili/p/12915656.html
今日推荐