elment-ui中 給table表格 某項加點擊事件


 

 

情況一:前端寫表格

 

代碼:

<template>
<el-table-column
header-align="center"
align="center"
label="單據編號"
prop="statementBaseNo"
>
<template slot-scope="scope">
<el-button type="text" @click="statementBaseNoJump(scope.row)">{{scope.row.statementBaseNo}}</el-button>
</template>
</el-table-column>
</template>

<script>
//點擊跳轉頁面

statementBaseNoJump(row) {
        this.$router.push({
path: "/checkBillStatementSaleManageDetail",
query: { refreshtarget: true, id: row.extId,billCheckType: row.billCheckType,ids: this.$route.query.id}
});
}
</script>

情況二:后端寫表格

<el-table-column
v-for="(col, index) in localShowTableCols"
:key="index + col.name"
:fixed="col.fixable"
:prop="col.name"
:label="col.title"
:min-width="col.columnWidth"
show-overflow-tooltip
header-align="center"
align="center"
>
<template slot-scope="scope">
<el-button
v-if="col.name === 'statementBaseNo'"
@click="returnDetail(scope)"
type="text"
size="small"
v-auth="4"
>
{{ scope.row[col.name] }}
</el-button>
<span v-else>{{ getValue(scope.row, col.name) }}</span>
</template>
</el-table-column>


補充:localShowTableCols為動態列數據
statementBaseNo為單據編號
returnDetail為點擊事件





免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM