在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ vue+ element table如何給指定的單元格添加點(diǎn)擊事件?

vue+ element table如何給指定的單元格添加點(diǎn)擊事件?

我想給這幾個(gè)指定的單元格添加點(diǎn)擊事件,我知道element table里面有cell-click事件,但是cell-click添加后 會(huì)對(duì)所有的單元格都點(diǎn)擊圖片描述

 <el-table :data="tableData " border style="width: 100%" ref="multipleTable" @selection-change="handleSelectionChange" @cell-click="openactivename">
    <el-table-column type="selection" width="55"></el-table-column>
    <el-table-column prop="activename" label="活動(dòng)名稱"  width="150"></el-table-column>
    <el-table-column prop="startdate" label="活動(dòng)開始時(shí)間" width="150"></el-table-column>
    <el-table-column prop="enddate" label="活動(dòng)結(jié)束時(shí)間" width="150"></el-table-column>
    <el-table-column prop="joinpeoplenum" label="參與人數(shù)" width="150" >
    </el-table-column>
    <el-table-column prop="opencardnum" label="辦卡人數(shù)" width="150" >
    </el-table-column>
    <el-table-column prop="goods" label="活動(dòng)兌換商品" width="120" >
    </el-table-column>
    <el-table-column prop="order" label="商品訂單" :formatter="formatter" >
    </el-table-column>
    <el-table-column label="操作" width="180">
        <template slot-scope="scope">
            <el-button size="small"
                       @click="handleEdit()">編輯</el-button>
            <el-button size="small" type="danger"
                       @click="handleDelete(scope.$index, scope.row)">刪除</el-button>
        </template>
    </el-table-column>
</el-table>

只點(diǎn)擊這幾個(gè)指定的話怎么處理呢?

回答
編輯回答
舊城人

可以跟你最后一列操作列那樣自己寫模版。
然后判斷執(zhí)行。

2017年9月30日 20:32
編輯回答
瞄小懶

或者操作dom判斷綁定,

2017年2月22日 09:27
編輯回答
茍活

那動(dòng)態(tài)獲取的表格數(shù)據(jù)怎么綁定到表格里,prop好像沒用

2017年9月25日 19:50
編輯回答
乖乖瀦

問題早就解決了 只是一直忘了把答案寫出來 ,補(bǔ)上。。。

<el-table-column prop="peoples_count" label="參與人數(shù)" align="center" width="150">
    <template slot-scope="scope">
        <el-button type="text" size="small" @click="handleJoinPeople(scope.row)" v-if="scope.row.peoples_count==0">管理參與人數(shù)</el-button>
        <el-button type="text" size="small" @click="handleJoinPeople(scope.row)" v-else>{{scope.row.peoples_count}}</el-button>
    </template>
</el-table-column>
<el-table-column prop="yxcard_count" label="辦卡人數(shù)" align="center" width="150" >
    <template slot-scope="scope">
        <el-button type="text" size="small" @click="handleCard(scope.row)" v-if="scope.row.yxcard_count==0">管理辦卡人數(shù)</el-button>
        <el-button type="text" size="small" @click="handleCard(scope.row)" v-else>{{scope.row.yxcard_count}}</el-button>
    </template>
</el-table-column>
<el-table-column prop="goods_count" label="活動(dòng)兌換商品" align="center" width="150" >
    <template slot-scope="scope">
        <el-button type="text" size="small" @click="handleGoods(scope.row)" v-if="scope.row.goods_count==0">管理活動(dòng)商品</el-button>
        <el-button type="text" size="small" @click="handleGoods(scope.row)" v-else>{{scope.row.goods_count}}</el-button>
    </template>
</el-table-column>
<el-table-column prop="order_count" align="center" label="商品訂單" >
    <template slot-scope="scope">
        <el-button type="text" size="small" @click="handleOrder(scope.row)" v-if="scope.row.order_count==0">管理訂單</el-button>
        <el-button type="text" size="small" @click="handleOrder(scope.row)" v-else>{{scope.row.order_count}}</el-button>
    </template>
</el-table-column>
   handleJoinPeople(row,id){
        console.log(row.ac_id);
        
    },
    handleCard(row,id){
        console.log(row.ac_id);
    },

這樣就好了

2017年4月14日 13:38
編輯回答
尛憇藌
<el-table-column prop="joinpeoplenum" label="參與人數(shù)" width="150" >
    <template slot-scope="scope">
        <p @click=handle(scope.row.num,scope.row.id)>{{scope.row.num,scope.row.id}}<p>
    </template>    
</el-table-column>
handle(num,id){
    if(id==id){
        your code
    }
}
2018年1月29日 23:01