index_1.vue
1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<template>
<view class="dynamicModel-v">
<template v-if="showPage">
<template v-if="webType==1">
<Form :config="config" :modelId="modelId" :isPreview="isPreview" />
</template>
<template v-if="webType==2||webType==3">
<List :config="config" :modelId="modelId" :isPreview="isPreview" :title="title" />
</template>
</template>
</view>
</template>
<script>
import Form from './components/form/index.vue'
import List from './components/list/index.vue'
import {
getConfigData
} from '@/api/apply/visualDev'
export default {
name: 'dynamicModel',
components: {
Form,
List
},
data() {
return {
webType: '',
showPage: false,
isPreview: '0',
modelId: '',
title: '',
config: {}
}
},
onLoad(option) {
this.modelId = option.id;
this.isPreview = option.isPreview || '0';
this.title = option.fullName || '';
this.getConfigData()
},
methods: {
getConfigData() {
getConfigData(this.modelId).then(res => {
if (res.code !== 200 || !res.data) {
uni.showToast({
title: '暂无此页面',
icon: 'none',
complete: () => {
setTimeout(() => {
uni.navigateBack()
}, 1500)
}
})
return
}
this.config = res.data
this.webType = res.data.webType || '2'
this.title = this.title ? this.title : res.data.fullName
uni.setNavigationBarTitle({
title: this.title
})
this.showPage = true
})
}
}
}
</script>
<style lang="scss">
page {
background-color: #f0f2f6;
}
.dynamicModel-v {
height: 100%;
}
</style>