Update default.html

This commit is contained in:
HAHWUL 2020-09-27 14:36:40 +09:00 committed by GitHub
parent 73e8cd2e04
commit 0da3dfa926
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,8 +79,10 @@
<td> <td>
<input type="checkbox" v-model="checked" :value="lang.id" number> <input type="checkbox" v-model="checked" :value="lang.id" number>
</td> </td>
{ % raw % }
<td> {{ lang.id }}</td> <td> {{ lang.id }}</td>
<td> {{ lang.name }}</td> <td> {{ lang.name }}</td>
{ % endraw % }
</tr> </tr>
</table> </table>
</div> </div>
@ -90,33 +92,33 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.3.4/vue.min.js"> <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.3.4/vue.min.js">
<script> <script>
window.onload = function(){ window.onload = function(){
new Vue({ new Vue({
data: { data: {
langs: [ langs: [
{ "id": "1", "name": "Edward"}, { "id": "1", "name": "Edward"},
{ "id": "2", "name": "Lance"}, { "id": "2", "name": "Lance"},
{ "id": "3", "name": "Arellano"}, { "id": "3", "name": "Arellano"},
{ "id": "4", "name": "Lorilla"}, { "id": "4", "name": "Lorilla"},
], ],
checked: [] checked: []
}, },
computed: { computed: {
checkAll: { checkAll: {
get: function () { get: function () {
return this.langs ? this.checked.length == this.langs.length : false; return this.langs ? this.checked.length == this.langs.length : false;
}, },
set: function (value) { set: function (value) {
var checked = []; var checked = [];
if (value) { if (value) {
this.langs.forEach(function (lang) { this.langs.forEach(function (lang) {
checked.push(lang.id); checked.push(lang.id);
}); });
}
this.checked = checked;
} }
this.checked = checked;
} }
} }
} }).$mount('#app');
}).$mount('#app');
}; };
</script> </script>
</div> </div>