mirror of
https://gitee.com/dromara/go-view.git
synced 2025-04-06 03:58:04 +08:00
feat: 添加静态数据可修改功能
This commit is contained in:
parent
74abb136a4
commit
3ca332381e
@ -58,11 +58,11 @@
|
|||||||
<n-input v-model:value="item.mapping" type="text" size="small" placeholder="小" />
|
<n-input v-model:value="item.mapping" type="text" size="small" placeholder="小" />
|
||||||
</td>
|
</td>
|
||||||
<!-- <td>
|
<!-- <td>
|
||||||
<n-space style="width: 70px" :size="4">
|
<n-space style="width: 70px" :size="4">
|
||||||
<n-badge dot :type="item.result === 1 ? 'success' : 'error'"></n-badge>
|
<n-badge dot :type="item.result === 1 ? 'success' : 'error'"></n-badge>
|
||||||
<n-text>匹配{{ item.result === 1 ? '成功' : '失败' }}</n-text>
|
<n-text>匹配{{ item.result === 1 ? '成功' : '失败' }}</n-text>
|
||||||
</n-space>
|
</n-space>
|
||||||
</td> -->
|
</td> -->
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</n-table>
|
</n-table>
|
||||||
@ -113,7 +113,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</n-space>
|
</n-space>
|
||||||
<n-card size="small">
|
<n-card size="small">
|
||||||
<n-code :code="toString(source)" language="json"></n-code>
|
<!-- <n-code :code="toString(source)" language="json"></n-code> -->
|
||||||
|
<monaco-editor
|
||||||
|
:modelValue="JSON.stringify(source, null, 2)"
|
||||||
|
@update:modelValue="handleEditorUpdate"
|
||||||
|
language="json"
|
||||||
|
width="100%"
|
||||||
|
height="520px"
|
||||||
|
/>
|
||||||
|
<n-button class="sourceBtn-item" @click="handleRun"> 运行 </n-button>
|
||||||
</n-card>
|
</n-card>
|
||||||
</n-space>
|
</n-space>
|
||||||
</n-timeline-item>
|
</n-timeline-item>
|
||||||
@ -130,6 +138,7 @@ import { ChartDataMonacoEditor } from '../ChartDataMonacoEditor'
|
|||||||
import { useFile } from '../../hooks/useFile.hooks'
|
import { useFile } from '../../hooks/useFile.hooks'
|
||||||
import { useTargetData } from '../../../hooks/useTargetData.hook'
|
import { useTargetData } from '../../../hooks/useTargetData.hook'
|
||||||
import { toString, isArray } from '@/utils'
|
import { toString, isArray } from '@/utils'
|
||||||
|
import { MonacoEditor } from '@/components/Pages/MonacoEditor'
|
||||||
|
|
||||||
const { targetData } = useTargetData()
|
const { targetData } = useTargetData()
|
||||||
defineProps({
|
defineProps({
|
||||||
@ -240,6 +249,21 @@ const initFieldListHandle = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 处理编辑器内容更新
|
||||||
|
const handleEditorUpdate = (val: string) => {
|
||||||
|
try {
|
||||||
|
if (!val) return (source.value = '此组件无数据源')
|
||||||
|
source.value = JSON.parse(val)
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听点击运行按钮的事件
|
||||||
|
const handleRun = () => {
|
||||||
|
targetData.value.option.dataset = source.value
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => targetData.value?.option?.dataset,
|
() => targetData.value?.option?.dataset,
|
||||||
(
|
(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user