<CheckboxGroup v-model="fruit">
<Checkbox v-for="(item,key) in historyData" :key="item.id" :label="item.id" :value="item.id" size="large" @on-change="select">
<span>{{item.name}}</span>
</Checkbox>
</CheckboxGroup>
var vue = new Vue({
el: "-sharpapp",
data (){
return {
historyData:[],
fruit: []
}
},
methods: {
// 1
querytable(evt){
var dataSource = [];
$.ajax({
url: "/userRole/getRoles",
type:"post",
data: {
},
async : false,
dataType:"json",
success: function(data){
if(data.type == "success"){
dataSource = data;
}
}});
this.historyData = dataSource.list;
for (var i = 0; i < dataSource.list.length; iPP) {
this.fruit.push(dataSource.list[i].id)
}
},
select(){
console.log(this.fruit);
}
},
//
created () {
this.querytable();
}
});
question 1 cannot display value
how to get the selected value when question 2 is submitted
A novice asks for advice ~