Answer the question
In order to leave comments, you need to log in
How can I make it so that when clicking on the first checkbox, the subsequent ones would be blocked?
Good afternoon) Please help with the task) It is necessary that when you click on the first checkbox, the other two are blocked
<div id="app">
<useredit></useredit>
<userinfo></userinfo>
</div>
<script>
var eventBus = new Vue();
Vue.component('useredit', {
props: ["user"],
template: `<div>
<label v-for="n in items"> <input v-model="n.checked" type="checkbox" :disabled="!block">
</div>`,
data() {
return {
items:[
{ value: [1, 1], checked: false, message: 'Шаблон'},
],
}
},
methods:{
block(){
eventBus.$emit("userchange", this.items);
},
}
});
Vue.component('userinfo', {
props: ["user"],
template: '<div><label v-for="n in items"> <input v-model="n.checked" type="checkbox" :disabled="created"></div>',
data() {
return {
items:[
{ value: [1, 1], checked: false, message: 'Шаблон', disabled: false},
{ value: [1, 1], checked: false, message: 'Шаблон', disabled: false},
{ value: [1, 1], checked: false, message: 'Шаблон', disabled: false},
],
}
},
created(){
eventBus.$on("userchange", (name)=>{
this.items = !this.items;
});
}
});
new Vue({
el: "#app",
data:{
}
});
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question