1111111
<script setup> import { ref, watch } from 'vue' const isShow = ref(false) const value = ref("") watch(() => value.value, (val) => { if(val === 'hhh') { isShow.value = true return } if(val === 'lll') { isShow.value = true return } // and other conditions... isShow.value = false }) </script> <template> <div v-if="isShow"> Showing </div> <input v-model="value" /> </template>
<script setup> import { ref, watchEffect } from 'vue' const isShow = ref(false) const value1 = ref("") const value2 = ref("") watchEffect(() => { if(value1.value === 'hhh' && value2.value === 'lll') { isShow.value = true return } isShow.value = false }) </script> <template> <div v-if="isShow"> Showing </div> <input v-model="value1" /> <input v-model="value2" /> </template>