<html lang="en">
<head>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<body>
<div id="app">
<h3>Vue 3 Set Default Value</h3>
<select v-model="selectedValue">
<option value="computer">Computer</option>
<option value="laptop">Laptop</option>
<option value="mobile">Mobile</option>
</select>
</div>
<script type="module">
const { createApp, ref } = Vue;
createApp({
setup() {
const selectedValue = ref('laptop');
return {
selectedValue
};
}
}).mount("#app");
</script>
<style scoped>
select {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border: none;
width: 200px;
background-color: transparent;
padding: 10px;
font-size: 16px;
cursor: pointer;
border-bottom: 2px solid #ccc;
}
select:focus {
outline: none;
border-color: #007bff;
}
</style>
</body>
</html>