简体   繁体   English

Vue材料在表格中为每一行添加模式按钮

[英]Vue material add modal button in a table for each row

I have this code in vue that is a table with the component "vue materials" and what I try to do is that for row of the table I put a button that launches me a modal, for that I have this code but it does not do anything to me 我在vue中有此代码,该代码是一个包含“ vue材料”组件的表格,我试图做的是,在表格的行中放置了一个启动模式的按钮,因为我有此代码,但没有对我做什么

  <md-table v-model="payslips" md-sort="created_at" md-sort-order="asc" md-card md-fixed-header> <md-table-row slot="md-table-row" slot-scope="{ item }"> <md-table-cell md-label="User" md-sort-by="alias">{{ item.user.name }}</md-table-cell> <md-table-cell md-label=""><md-button class="md-raised" @click.native="downloadFile(item.id,false)" >Show</md-button></md-table-cell> <md-table-cell md-label=""> <md-dialog-confirm :md-active.sync="active" md-title="Use Google's location service?" md-content="Let Google help apps determine location. <br> This means sending <strong>anonymous</strong> location data to Google, even when no apps are running." md-confirm-text="Agree" md-cancel-text="Disagree" @md-cancel="onCancel" @md-confirm="onConfirm" /> <md-button class="md-primary md-raised" @click="active = true">Delete</md-button> </md-table-cell> </md-table-row> </md-table> 

On method I have this code 在方法上我有这段代码

  onConfirm: function onConfirm() { console.log(this.value); }, onCancel: function onCancel() { console.log(this.value); } 
 

Try this - you don't need to add the function name just before the ()'s 试试看-您不需要在()的前面添加函数名称

  onConfirm: function () { console.log(this.value); }, onCancel: function () { console.log(this.value); } 

Alternatively, you could use an even simpler syntax 另外,您可以使用更简单的语法

  onConfirm () { console.log(this.value); }, onCancel () { console.log(this.value); } 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM