Skip to content

Commit

Permalink
fix: fix demo bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Liberty-liu committed Apr 7, 2023
1 parent e29489c commit 0f90b36
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
8 changes: 4 additions & 4 deletions examples/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ const handle = (val) => {
}
</script>
<template>
<el-radio-group v-if="$route.name !== 'objEdit'" v-model="lang" @change="handle">
<el-radio label="zh-cn" size="large">中文</el-radio>
<el-radio label="en" size="large">English</el-radio>
</el-radio-group>
<!-- <el-radio-group v-if="$route.name !== 'objEdit'" v-model="lang" @change="handle">-->
<!-- <el-radio label="zh-cn" size="large">中文</el-radio>-->
<!-- <el-radio label="en" size="large">English</el-radio>-->
<!-- </el-radio-group>-->
<router-view></router-view>
</template>
12 changes: 10 additions & 2 deletions examples/views/formEditor/actionEdit.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<script setup>
import { ref, onMounted, reactive, inject } from 'vue'
import { ref, onMounted, reactive, inject, nextTick } from 'vue'
import { useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
import hooks from '@ER/hooks'
import { erFormPreview } from '@ER/formEditor'
import uri from '@ER-examples/uri.js'
const route = useRoute()
const loading = ref(true)
const isRender = ref(false)
const {
lang
} = inject('globalConfig')
Expand All @@ -15,6 +16,7 @@ const isEdit = !!route.params.actionid
const state = reactive({
name: ''
})
const layoutType = ref()
const getObjData = async () => {
try {
const data = []
Expand All @@ -24,6 +26,7 @@ const getObjData = async () => {
method: 'get'
})
data.push(data0.content)
layoutType.value = data0.content.layoutType
if (isEdit) {
const {
data: data1
Expand All @@ -32,7 +35,10 @@ const getObjData = async () => {
})
data.push(data1.content)
}
EReditorRef.value.setData(...data)
isRender.value = true
nextTick(() => {
EReditorRef.value.setData(...data)
})
} finally {
loading.value = false
}
Expand Down Expand Up @@ -64,6 +70,8 @@ onMounted(() => {
<template>
<er-form-preview
:lang="lang"
v-if="isRender"
:layoutType="layoutType"
@listener="handleListener"
v-loading="loading"
ref="EReditorRef"/>
Expand Down
2 changes: 1 addition & 1 deletion packages/formEditor/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
'Input',
'Email',
'ID number',
'Phone',
'Cellphone',
'URL'
],
textarea: 'Textarea',
Expand Down

0 comments on commit 0f90b36

Please sign in to comment.