Skip to content

Commit 9d207c9

Browse files
committed
fix: search.vue 的 props.modelValue 重新赋值失去响应性问题
1 parent f85f97a commit 9d207c9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Web/src/components/table/search.vue

+6-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
</template>
106106

107107
<script setup lang="ts" name="makeTableDemoSearch">
108-
import { reactive, ref } from 'vue';
108+
import { reactive, ref, toRefs } from 'vue';
109109
import type { FormInstance } from 'element-plus';
110110
import { saulVModel } from '/@/utils/saulVModel';
111111
@@ -129,7 +129,11 @@ const props = defineProps({
129129
130130
// 定义子组件向父组件传值/事件
131131
const emit = defineEmits(['search', 'reset', 'update:modelValue']);
132-
const searchModel = ref(props.modelValue);
132+
133+
// 将 props中的值转为 ref
134+
const refProps = toRefs(props);
135+
const searchModel = refProps.modelValue;
136+
133137
// 定义变量内容
134138
const tableSearchRef = ref<FormInstance>();
135139
const state = reactive({

0 commit comments

Comments
 (0)