init 6
This commit is contained in:
parent
f9c6ea0726
commit
dce2713f4b
@ -4,7 +4,7 @@
|
||||
|
||||
<!-- Basic Page Needs –––––––––––––––––––––––––––––––––––––––––––––––––– -->
|
||||
<meta charset="utf-8">
|
||||
<title>Your page title here :)</title>
|
||||
<title>Steam Workshop Viewer</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
<template x-for="item in items" :key="item.id">
|
||||
<tr>
|
||||
<td>
|
||||
<input type="checkbox" x-on:click="checkItem" x-model="checkedItems" x-bind:value="item" class="checkbox"/>
|
||||
<input type="checkbox" x-model="checkedItems" x-bind:value="item.id" class="checkbox" />
|
||||
</td>
|
||||
<td x-text="item.id"></td>
|
||||
<td x-text="item.title"></td>
|
||||
|
||||
12
src/index.js
12
src/index.js
@ -16,22 +16,12 @@ document.addEventListener('alpine:init', () => {
|
||||
items: [],
|
||||
loading: false,
|
||||
checkedItems: [],
|
||||
checkItem(e) {
|
||||
let checkedItem = e.target.value;
|
||||
console.log('checkedItem', checkedItem);
|
||||
|
||||
let checkbox = document.querySelectorAll('.checkbox').find(cb => cb.value === checkedItem.id);
|
||||
checkbox.checked = e.target.checked;
|
||||
|
||||
console.log(this.checkedItems);
|
||||
},
|
||||
checkItems(e) {
|
||||
if (e.target.checked) {
|
||||
this.checkedItems = this.items;
|
||||
this.checkedItems = this.items.map(item => item.id);
|
||||
} else {
|
||||
this.checkedItems = [];
|
||||
}
|
||||
console.log(this.checkedItems);
|
||||
},
|
||||
async getModDescription() {
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user