feat: Add Error component

This commit is contained in:
kailong321200875
2022-02-19 15:36:18 +08:00
parent 1492f9119a
commit 7411dbc9fd
14 changed files with 16154 additions and 17 deletions

View File

@@ -186,7 +186,7 @@ const save = async () => {
</ContentWrap>
<Dialog v-model="dialogVisible" :title="dialogTitle">
<Write v-if="actionType === 'edit'" ref="writeRef" :current-row="tableObject.currentRow" />
<Write v-if="actionType !== 'detail'" ref="writeRef" :current-row="tableObject.currentRow" />
<Detail v-if="actionType === 'detail'" :current-row="tableObject.currentRow" />

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import { Form } from '@/components/Form'
import { useForm } from '@/hooks/web/useForm'
import { PropType, reactive } from 'vue'
import { PropType, reactive, watch } from 'vue'
import { TableData } from '@/api/table/types'
import { useI18n } from '@/hooks/web/useI18n'
import { required } from '@/utils/formRules'
@@ -113,17 +113,25 @@ const { register, methods, elFormRef } = useForm({
schema
})
if (props.currentRow) {
const { setValues, setSchema } = methods
setValues(props.currentRow)
setSchema([
{
field: 'content',
path: 'componentProps.defaultHtml',
value: props.currentRow.content
}
])
}
watch(
() => props.currentRow,
(currentRow) => {
if (!currentRow) return
const { setValues, setSchema } = methods
setValues(currentRow)
setSchema([
{
field: 'content',
path: 'componentProps.defaultHtml',
value: currentRow.content
}
])
},
{
deep: true,
immediate: true
}
)
defineExpose({
elFormRef,