Use attribute binding for data-... attributes
See: https://polymer-library.polymer-project.org/2.0/docs/devguide/data-binding#native-binding Change-Id: Ia0791729705cf8a02b3fbbb98961c274e80dedf9
This commit is contained in:
committed by
David Pursehouse
parent
0998cfad1a
commit
049cc0bc09
@@ -73,7 +73,7 @@ limitations under the License.
|
||||
<gr-button
|
||||
link
|
||||
disabled$="[[disabled]]"
|
||||
data-item="[[item]]"
|
||||
data-item$="[[item]]"
|
||||
on-click="_handleDelete">Delete</gr-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
},
|
||||
|
||||
_handleDelete(e) {
|
||||
const value = Polymer.dom(e).localTarget.dataItem;
|
||||
const value = Polymer.dom(e).localTarget.dataset.item;
|
||||
this._dispatchChanged(
|
||||
this.pluginOption.info.values.filter(str => str !== value));
|
||||
},
|
||||
|
||||
@@ -61,21 +61,21 @@ limitations under the License.
|
||||
<td class="buttonColumn">
|
||||
<gr-button
|
||||
link
|
||||
data-index="[[index]]"
|
||||
data-index$="[[index]]"
|
||||
on-click="_handleMoveUpButton"
|
||||
class="moveUpButton">↑</gr-button>
|
||||
</td>
|
||||
<td class="buttonColumn">
|
||||
<gr-button
|
||||
link
|
||||
data-index="[[index]]"
|
||||
data-index$="[[index]]"
|
||||
on-click="_handleMoveDownButton"
|
||||
class="moveDownButton">↓</gr-button>
|
||||
</td>
|
||||
<td>
|
||||
<gr-button
|
||||
link
|
||||
data-index="[[index]]"
|
||||
data-index$="[[index]]"
|
||||
on-click="_handleDeleteButton"
|
||||
class="remove-button">Delete</gr-button>
|
||||
</td>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
},
|
||||
|
||||
_handleMoveUpButton(e) {
|
||||
const index = Polymer.dom(e).localTarget.dataIndex;
|
||||
const index = Number(Polymer.dom(e).localTarget.dataset.index);
|
||||
if (index === 0) { return; }
|
||||
const row = this.menuItems[index];
|
||||
const prev = this.menuItems[index - 1];
|
||||
@@ -35,7 +35,7 @@
|
||||
},
|
||||
|
||||
_handleMoveDownButton(e) {
|
||||
const index = Polymer.dom(e).localTarget.dataIndex;
|
||||
const index = Number(Polymer.dom(e).localTarget.dataset.index);
|
||||
if (index === this.menuItems.length - 1) { return; }
|
||||
const row = this.menuItems[index];
|
||||
const next = this.menuItems[index + 1];
|
||||
@@ -43,7 +43,7 @@
|
||||
},
|
||||
|
||||
_handleDeleteButton(e) {
|
||||
const index = Polymer.dom(e).localTarget.dataIndex;
|
||||
const index = Number(Polymer.dom(e).localTarget.dataset.index);
|
||||
this.splice('menuItems', index, 1);
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user