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"> <div class="custom-select-wrapper"> <h3>Vue js Select On Change Update Value</h3> <select class="custom-select" v-model="selectedFruit"> <option v-for="fruit in fruits" :key="fruit.value" :value="fruit.value" > {{ fruit.label }} </option> </select> <p>Selected Fruit: {{ selectedFruit }}</p> </div> </div> <script type="module"> const app = Vue.createApp({ data() { return { selectedFruit: null, fruits: [ { value: "apple", label: "Apple" }, { value: "banana", label: "Banana" }, { value: "orange", label: "Orange" }, ], }; }, watch: { selectedFruit(newValue) { // You can perform any logic here when the fruit selection changes this.selectedFruit = newValue; }, }, }); app.mount("#app"); </script> <style> /* Style the select element */ select { width: 100%; appearance: none; /* remove default styling */ font-family: inherit; font-size: 16px; color: #333; padding: 10px; border: none; border-bottom: 2px solid #333; background-color: transparent; border-radius: 0; outline: none; cursor: pointer; transition: border-bottom-color 0.2s ease-in-out; } /* Style the select element when it's focused */ select:focus { border-bottom-color: #0077ff; } /* Style the paragraph element */ p { font-family: Arial, sans-serif; font-size: 14px; color: #555; margin-top: 20px; } /* Style the container div */ #app { margin: 0 auto; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.24); width: 400px; padding: 20px; } </style> </body> </html>