<script setup>
import { ref } from 'vue'
const optionsDefault = ['value 1', 'value 2', 'value 3']
const activeSelect = ref('value 1')
const options = ref(optionsDefault)
const updateCount = ref(0)
const updateOptions = () => {
setInterval(() => {
options.value = optionsDefault;
updateCount.value ++;
}, 3000)
}
</script>
<template>
<h2>update cnt: {{updateCount}}</h2>
<div>active value: {{activeSelect}}</div>
<select
v-model="activeSelect"
>
<option
v-for="option in options"
:key="option"
:value="option"
>
{{ option }}
</option>
</select>
<hr>
<div>
<button @click="updateOptions">start updating</button>
</div>
</template>