screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <script src="https://unpkg.com/vue@3.2.12/dist/vue.global.js"></script> </head> <body> <div id="app"> <h3>Vue Js Disable selected dropdown options Example</h3> <select v-model="selectedValue"> <option value="">Select Option</option> <option v-for="option in options" :value="option.value" :disabled="selectedValue === option.value"> {{ option.label }} </option> </select> <p>Selected Value: {{ selectedValue }}</p> </div> <script type="module"> const app = Vue.createApp({ data() { return { selectedValue: '', options: [ { label: 'Option 1', value: 'option1' }, { label: 'Option 2', value: 'option2' }, { label: 'Option 3', value: 'option3' } ] }; } }); app.mount('#app'); </script> <style> #app { text-align: center; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.24); width: 600px; margin: 0 auto; transition: transform 0.3s ease; } /* Styling for the select element */ select { padding: 10px; font-size: 16px; border: 1px solid #ccc; border-radius: 4px; width: 200px; margin-bottom: 10px; } /* Styling for the disabled options */ option[disabled] { color: #ccc; } /* Styling for the selected value paragraph */ p { font-size: 16px; margin: 0; } </style> </body> </html>