Commit 458cc76b6424f4eb10c3d7e25a256df0ae69f5ae

Authored by 杨泽宇
1 parent 5b39a314

debug

Showing 1 changed file with 7 additions and 10 deletions
src/views/property/edit.vue
1 1 <script setup lang="ts">
2   -import { reactive, ref, getCurrentInstance, onMounted, watch } from "vue";
  2 +import { reactive, ref, getCurrentInstance, onMounted, watchEffect } from "vue";
3 3 import { useRoute } from "vue-router";
4 4 import { propertyAdd } from "@/api/property";
5 5 import { allNeighborhood } from "@/api/community/residence";
... ... @@ -180,16 +180,13 @@ onMounted(() =&gt; {
180 180 }
181 181 // 创建物业时不需要关联小区
182 182 // 创建公益时必须关联小区,至少一个,可以多选
183   - watch(
184   - () => form.data.type,
185   - (data) => {
186   - if (~~data === 1) {
187   - rules.neighborhoodIds[0].required = false;
188   - } else if (~~data === 2) {
189   - rules.neighborhoodIds[0].required = true;
190   - }
  183 + watchEffect(() => {
  184 + if (~~form.data.type === 1) {
  185 + rules.neighborhoodIds[0].required = false;
  186 + } else if (~~form.data.type === 2) {
  187 + rules.neighborhoodIds[0].required = true;
191 188 }
192   - );
  189 + });
193 190 });
194 191 </script>
195 192  
... ...