element ui使用技巧

353 阅读1分钟

1.在表格中插入别的组件时可以用模板语法如

<el-table-column label="状态" align="center" v-if="isAdmin" width="110">
    <template slot-scope="scope">
          <el-switch
              v-model="scope.row.status"
              active-value="0"
              inactive-value="1"
              @change="handleStatusChange(scope.row)"
              ></el-switch>
    </template>
</el-table-column>

2.当使用表格的时候你可以选择不写prop属性,可以用scope也就是用模板语法插入 3.select选项的默认值用v-model选择label值