hookehuyr

fix 编辑模式不能提交数据

...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
27 <van-form @submit="onSubmit"> 27 <van-form @submit="onSubmit">
28 <van-cell-group :border="false"> 28 <van-cell-group :border="false">
29 <component 29 <component
30 + :id="item.key"
30 :ref="item.component_props.name" 31 :ref="item.component_props.name"
31 v-for="(item, index) in formData" 32 v-for="(item, index) in formData"
32 :key="index" 33 :key="index"
...@@ -35,8 +36,13 @@ ...@@ -35,8 +36,13 @@
35 @active="onActive" 36 @active="onActive"
36 /> 37 />
37 </van-cell-group> 38 </van-cell-group>
38 - <div style="margin: 16px"> 39 + <div v-if="formData.length" style="margin: 16px">
39 - <van-button round block type="primary" native-type="submit"> 提交 </van-button> 40 + <van-button v-if="model === 'edit'" round block type="primary">
41 + 提交
42 + </van-button>
43 + <van-button v-else round block type="primary" native-type="submit">
44 + 提交
45 + </van-button>
40 </div> 46 </div>
41 </van-form> 47 </van-form>
42 </van-config-provider> 48 </van-config-provider>
...@@ -76,6 +82,9 @@ const mockData = ref([]); ...@@ -76,6 +82,9 @@ const mockData = ref([]);
76 const formData = ref([]); 82 const formData = ref([]);
77 const postData = ref({}); 83 const postData = ref({});
78 84
85 +// 编辑模式不能提交操作
86 +const model = $route.query.model;
87 +
79 // 格式化表单数据结构 88 // 格式化表单数据结构
80 const formatData = (data) => { 89 const formatData = (data) => {
81 const arr = []; 90 const arr = [];
......