<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://unpkg.com/buefy/dist/buefy.min.css">
<b-field>
<b-input type="number" v-model="total" min="0" max="255"></b-input>
</b-field>
<b-field grouped group-multiline>
<b-checkbox-button
v-model="checked"
:native-value="item"
v-for="(item,key) in items" :key="key">{{ item }}</b-checkbox-button>
</b-field>
<!-- Full bundle -->
<script src="https://unpkg.com/buefy/dist/buefy.min.js"></script>
<!-- Individual components -->
<script src="https://unpkg.com/buefy/dist/components/table"></script>
<script src="https://unpkg.com/buefy/dist/components/input"></script>
new Vue({
el: '#app',
data() {
return {
total: "42",
items: null,
checked: [],
}
},
watch: {
total(val, oldVal) {
console.log(`total: ${oldVal} -> ${val}`)
this.update()
},
items(val, oldVal) {
console.log(`items: ${oldVal} -> ${val}`)
},
checked(val, oldVal) {
console.log(`checked: ${oldVal} -> ${val}`)
}
},
methods: {
update() {
this.items = new Array(parseInt(this.total))
for(let i=0; i<this.items.length; i++) {
this.items[i] = `${i+1}`
}
}
},
mounted() {
this.update(this.total)
}
})
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}