当前位置: 首页 > 工具软件 > PivotTable.js > 使用案例 >

vue.js slot-scope 取值

沈翰
2023-12-01

错误:

<template slot-scope="scope">   <!-- 取值必须用slot-scope -->
	<i class="scope.row.isWork === '是' ? 'el-icon-circle-check' : 'el-icon-circle-close'"></i>
</template>

正确:i class之间加冒号

   <template slot-scope="scope">   <!-- 取值必须用slot-scope -->
    	<i :class="scope.row.isWork === '是' ? 'el-icon-circle-check' : 'el-icon-circle-close'"></i>
   </template>

错误:

<template slot-scope="props">
    <el-form label-position="left" inline class="demo-table-expand">
         <el-radio  v-model="radio" label="props.row.sex">男</el-radio>
         <el-radio  v-model="radio" label="props.row.sex">女</el-radio>
    </el-form>
</template>

正确:"radio"label之间加冒号

<template slot-scope="props">
    <el-form label-position="left" inline class="demo-table-expand">
             <el-radio  v-model="radio" :label="props.row.sex">男</el-radio>
             <el-radio  v-model="radio" :label="props.row.sex">女</el-radio>
    </el-form>
</template>

总结:用到slot-scope取值时,取值表达式xxx.row.yyy项前面都应该加冒号

 类似资料: