소스 검색

✨ refactor(noProduct): 优化组件代码结构,调整导入顺序并格式化 watch 函数

陈雪 1 일 전
부모
커밋
70ffeca855
1개의 변경된 파일21개의 추가작업 그리고 17개의 파일을 삭제
  1. 21 17
      src/components/noProduct.vue

+ 21 - 17
src/components/noProduct.vue

@@ -5,21 +5,25 @@
   </div>
 </template>
 <script setup>
-import { useI18n } from 'vue-i18n'
-import { defineProps, watch } from 'vue'
-const { t } = useI18n()
-const props = defineProps({
-  img: {
-    type: String,
-    default: '@/assets/imgs/noFoods.svg',
-  },
-  text: {
-    type: String,
-    default: '还没添加菜品哦',
-  },
-})
-console.log(props)
-watch(()=>props.text, (newVal, oldVal) => {
-  console.log('text changed', newVal, oldVal)
-})
+  import { useI18n } from 'vue-i18n'
+  import { watch } from 'vue'
+
+  const { t } = useI18n()
+  const props = defineProps({
+    img: {
+      type: String,
+      default: '@/assets/imgs/noFoods.svg',
+    },
+    text: {
+      type: String,
+      default: '还没添加菜品哦',
+    },
+  })
+  console.log(props)
+  watch(
+    () => props.text,
+    (newVal, oldVal) => {
+      console.log('text changed', newVal, oldVal)
+    },
+  )
 </script>