fix: 处理 model 报错

This commit is contained in:
奔跑的面条 2023-01-08 19:20:44 +08:00
parent 7b262c9db2
commit 45cadcecc3
6 changed files with 44 additions and 15 deletions

View File

@ -1,5 +1,5 @@
<template>
<n-modal v-model:show="modelShow" @afterLeave="closeHandle">
<n-modal v-model:show="modelShowRef" @afterLeave="closeHandle">
<n-list bordered class="go-system-info">
<template #header>
<n-space justify="space-between">
@ -51,10 +51,10 @@ const props = defineProps({
const emit = defineEmits(['update:modelShow'])
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
const modelShow = ref(false)
const modelShowRef = ref(false)
watch(() => props.modelShow, (newValue) => {
modelShow.value = newValue
modelShowRef.value = newValue
})
const closeHandle = () => {

View File

@ -1,5 +1,5 @@
<template>
<n-modal v-model:show="modelShow" @afterLeave="closeHandle">
<n-modal v-model:show="modelShowRef" @afterLeave="closeHandle">
<n-list bordered class="go-system-setting">
<template #header>
<n-space justify="space-between">
@ -82,7 +82,7 @@ const props = defineProps({
const emit = defineEmits(['update:modelShow'])
const { HelpOutlineIcon, CloseIcon } = icon.ionicons5
const settingStore = useSettingStore()
const modelShow = ref(false)
const modelShowRef = ref(false)
const list = reactive<ListType[]>([
{
@ -168,7 +168,7 @@ const list = reactive<ListType[]>([
])
watch(() => props.modelShow, (newValue) => {
modelShow.value = newValue
modelShowRef.value = newValue
})
const closeHandle = () => {

View File

@ -1,5 +1,5 @@
<template>
<n-modal class="go-chart-data-pond-control" v-model:show="modelShow" :mask-closable="false">
<n-modal class="go-chart-data-pond-control" v-model:show="modelShowRef" :mask-closable="false">
<n-card :bordered="false" role="dialog" size="small" aria-modal="true" style="width: 900px; height: 650px">
<template #header></template>
<template #header-extra> </template>
@ -37,7 +37,6 @@
<!-- 请求配置model -->
<pond-data-request
v-if="requestShow"
v-model:modelShow="requestShow"
:targetDataRequest="editData"
:isEdit="isEdit"
@ -59,7 +58,7 @@ import { icon } from '@/plugins'
import { getUUID, goDialog } from '@/utils'
import { cloneDeep } from 'lodash'
defineProps({
const props = defineProps({
modelShow: Boolean
})
@ -68,6 +67,7 @@ const { PencilIcon } = icon.ionicons5
const { chartEditStore, targetData } = useTargetData()
const { requestDataPond } = toRefs(chartEditStore.getRequestGlobalConfig)
const requestShow = ref(false)
const modelShowRef = ref(false)
const loading = ref(false)
const isEdit = ref(false)
const editData = ref<RequestDataPondItemType>()
@ -82,6 +82,10 @@ const pondData = computed(() => {
return data[0]
})
watch(() => props.modelShow, (newValue) => {
modelShowRef.value = newValue
})
watch(
() => pondData.value,
newValue => {

View File

@ -1,5 +1,5 @@
<template>
<n-modal class="go-chart-data-request" v-model:show="modelShow" :mask-closable="false" :closeOnEsc="false">
<n-modal class="go-chart-data-request" v-model:show="modelShowRef" :mask-closable="false" :closeOnEsc="false">
<n-card :bordered="false" role="dialog" size="small" aria-modal="true" style="width: 1000px; height: 800px">
<template #header></template>
<template #header-extra> </template>
@ -29,7 +29,7 @@
</template>
<script script lang="ts" setup>
import { toRefs, PropType } from 'vue'
import { ref, toRefs, PropType, watch } from 'vue'
import { RequestContentTypeEnum } from '@/enums/httpEnum'
import { useTargetData } from '../../../hooks/useTargetData.hook'
import { RequestGlobalConfig } from './components/RequestGlobalConfig'
@ -46,11 +46,22 @@ const emit = defineEmits(['update:modelShow', 'sendHandle'])
//
const { chartConfig } = toRefs(props.targetData as CreateComponentType)
const { requestContentType } = toRefs((props.targetData as CreateComponentType).request)
const modelShowRef = ref(false)
const requestContentTypeObj = {
[RequestContentTypeEnum.DEFAULT]: '普通请求',
[RequestContentTypeEnum.SQL]: 'SQL 请求'
}
watch(
() => props.modelShow,
newValue => {
modelShowRef.value = newValue
},
{
immediate: true
}
)
const closeHandle = () => {
emit('update:modelShow', false)
}

View File

@ -1,5 +1,5 @@
<template>
<n-modal class="go-chart-data-request" v-model:show="modelShow" :mask-closable="false" :closeOnEsc="false">
<n-modal class="go-chart-data-request" v-model:show="modelShowRef" :mask-closable="false" :closeOnEsc="false">
<n-card :bordered="false" role="dialog" size="small" aria-modal="true" style="width: 1000px; height: 800px">
<template #header></template>
<template #header-extra> </template>
@ -42,7 +42,7 @@
</template>
<script script lang="ts" setup>
import { PropType, ref, watchEffect } from 'vue'
import { PropType, ref, watch } from 'vue'
import { RequestContentTypeEnum } from '@/enums/httpEnum'
import { useTargetData } from '../../../hooks/useTargetData.hook'
import { RequestGlobalConfig } from './components/RequestGlobalConfig'
@ -58,6 +58,12 @@ const emit = defineEmits(['update:modelShow', 'editSaveHandle'])
const pondName = ref()
const inputInstRef = ref()
const modelShowRef = ref(false)
watch(() => props.modelShow, (newValue) => {
modelShowRef.value = newValue
})
const closeHandle = () => {
emit('update:modelShow', false)

View File

@ -1,5 +1,5 @@
<template>
<n-modal v-model:show="modelShow" :mask-closable="true" @afterLeave="closeHandle">
<n-modal v-model:show="modelShowRef" :mask-closable="true" @afterLeave="closeHandle">
<n-table class="model-content" :bordered="false" :single-line="false">
<thead>
<tr>
@ -31,17 +31,24 @@
</template>
<script setup lang="ts">
import { watch, ref } from 'vue'
import { icon } from '@/plugins'
import { WinKeyboard, MacKeyboard } from '@/enums/editPageEnum'
const { CloseIcon } = icon.ionicons5
const modelShowRef = ref(false)
const emit = defineEmits(['update:modelShow'])
defineProps({
const props = defineProps({
modelShow: Boolean
})
watch(() => props.modelShow, (newValue) => {
modelShowRef.value = newValue
})
//
const shortcutKeyOptions = [
{
@ -121,6 +128,7 @@ const shortcutKeyOptions = [
mac: `${MacKeyboard.CTRL_SOURCE_KEY.toUpperCase()} + ${WinKeyboard.SHIFT.toUpperCase()} + G `
}
]
const closeHandle = () => {
emit('update:modelShow', false)
}