今天在寫table 時,想要用固定列code
我用的是:fixd: ""?"right":"",這種發現不起做用blog
<el-table :data="tableData" border stripe ref="tab"> <el-table-column v-for="(value,index) in tableHead" :key="index" :prop="value.id" :label="value.name" :min-width="value.width" align="center" :fixed="value.fixed"> <template slot-scope="scope"> <div v-if="value.id == 'tags'">{{ scope.row.tags|tags }}</div> <div v-else-if="value.id == 'typeId'">{{ scope.row.typeId|typeId }}</div> <div v-else-if="value.id == 'featured'">{{ scope.row.featured?scope.row.featured==1?'精選':'普通':"/" }}</div> <div v-else-if="value.id == 'show'">{{ scope.row.show?scope.row.show=='SHOW'?'展現':'隱藏':"/" }}</div> <div v-else-if="value.id == 'status'">{{ scope.row.status?scope.row.status=='replied'?'已答覆':'待答覆':"/" }} </div> <div v-else-if="value.id=='btn'"> <el-button @click="edior(scope.row)" type="primary" size="mini">編輯</el-button> <el-button @click="change(scope.row)" v-if="scope.row.featured==1" plain size="mini"> 普通 </el-button> <el-button @click="change(scope.row)" v-else type="warning" size="mini">精選</el-button> </div> <div v-else>{{ scope.row[value.id]||'/'}}</div> </template> </el-table-column> </el-table>
最後這樣寫才搞定ip
'io