Просмотр исходного кода

录食物关联营养素时,nv_spec默认为100克

wangyang 5 лет назад
Родитель
Сommit
71e60f27cc
2 измененных файлов с 4 добавлено и 4 удалено
  1. 1 1
      src/views/food/components/FoodDetail.vue
  2. 3 3
      src/views/food/nutrient.vue

+ 1 - 1
src/views/food/components/FoodDetail.vue

@@ -169,7 +169,7 @@ export default {
         this.postForm.images = [file.fileUrl]
       }
     },
-    queryTemplates(query) {
+    queryTemplates(query='') {
       getNutrientTemplates({ query }).then(res => {
         this.templates = res.data.list
       }).catch(() => {

+ 3 - 3
src/views/food/nutrient.vue

@@ -245,7 +245,7 @@ export default {
       foodId: '',
       list: [],
       nutrients: [],
-      params: { source: '营养标签', radio: 0 },
+      params: { source: '营养标签', radio: 0, nvSpec: 100, nvSpecUnit: '克' },
       loading: false,
       unitLoading: false,
       sources: [{ value: "营养标签" }, { value: "食品官方资料" }, { value: "计算值" }]
@@ -261,8 +261,8 @@ export default {
           this.$set(this.params, "nvSpec", this.list[0].nvSpec)
           this.$set(this.params, "nvSpecUnit", this.list[0].nvSpecUnit)
         } else {
-          this.$set(this.params, 'nvSpec', null)
-          this.$set(this.params, 'nvSpecUnit', null)
+          this.$set(this.params, 'nvSpec', 100)
+          this.$set(this.params, 'nvSpecUnit', '克')
         }
       })
     },