0
Component.js - 我來到這裏我的按鈕值,並將其更改:更改按鈕文字與Ember綁定,不使用jQuery
actions: {
changeValue: function() {
this.$().on('click', '.cellValue', function(event) {
if ($(this).text() == '|') {
$(this).text('-');
$(this).val('-');
} else if ($(this).text() == '-') {
$(this).text('|');
$(this).val('|');
} else {
}
});
}
}
Template.hbs - 有一個表裏面td按鈕哪個文本我想改變:
<table>
{{#each-in rows as |table tableRow|}}
{{#each tableRow as |singleRow|}}
<tr class="as">
{{#each singleRow as |tableRows|}}
<td>
<button id="button_id"{{action "changeValue"}} class="cellValue" value="{{tableRows}}">{{tableRows}}</button>
</td>
{{/each}}
</tr>
{{/each}}
{{/each-in}}
我怎麼能檢查值,並在其後設置 – Erik
喜埃裏克,我已經更新了代碼示例 – mausinc