fix: 修复设置器不更新问题 (#361)

This commit is contained in:
dayou 2024-07-23 15:39:43 +08:00 committed by sudoooooo
parent 591a98bff1
commit 6c396c6ec8
2 changed files with 13 additions and 2 deletions

View File

@ -68,7 +68,7 @@ watch(
() => props.formConfig.value, () => props.formConfig.value,
(newVal: boolean) => { (newVal: boolean) => {
if (newVal !== modelValue.value) { if (newVal !== modelValue.value) {
modelValue.value == !!newVal modelValue.value = !!newVal
} }
}, },
{ {

View File

@ -8,7 +8,7 @@
/> />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed } from 'vue' import { ref, computed, watch } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import 'element-plus/theme-chalk/src/message.scss' import 'element-plus/theme-chalk/src/message.scss'
import { FORM_CHANGE_EVENT_KEY } from '@/materials/setters/constant' import { FORM_CHANGE_EVENT_KEY } from '@/materials/setters/constant'
@ -65,6 +65,17 @@ const handleInputChange = (value: number) => {
emit(FORM_CHANGE_EVENT_KEY, { key, value }) emit(FORM_CHANGE_EVENT_KEY, { key, value })
} }
watch(
() => props.formConfig.value,
(newVal) => {
if (newVal !== modelValue.value) {
modelValue.value = newVal
}
},
{
immediate: true
}
)
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.star-form.star-form_horizon { .star-form.star-form_horizon {