Vue.js disable/enable dropdown menu if checkbox is checked?
P粉714844743
P粉714844743 2023-08-29 23:14:07
0
1
515

I'm trying to enable/disable dropdown:combination selection when my box is checked. It works fine when I Add Name but when Clientless is selected, it doesn't work in Edit Name work.

The dropdown should be disabled because "Clientless" is selected, and should only be enabled if I uncheck the box. However, when the box is checked, the dropdown menu is enabled, and when I uncheck the box, the dropdown menu is disabled.

data: { editSelect: true, }, methods: { noClient() { this.editSelect = !this.editSelect; },
   

Please help me understand what is wrong with my code. Also, if you have any suggestions on how I should code this problem differently, please let me know!

P粉714844743
P粉714844743

reply all (1)
P粉162773626

You can setv-modelon the checkbox and use that value to disable the dropdown.

const app = Vue.createApp({ data() { return { checkBox: false } } }) app.mount('#app')
 

checkBox: {{checkBox}}

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!