finish mook
This commit is contained in:
parent
1f7e5b8b7d
commit
47d5d6474a
@ -163,24 +163,26 @@ function getDefaultValue(property: any): string {
|
||||
}
|
||||
}
|
||||
|
||||
// 修改 watch 逻辑
|
||||
// watch(
|
||||
// () => props.modelValue,
|
||||
// (newVal) => {
|
||||
// const currentParsed = tryParse(inputValue.value)
|
||||
// if (!isDeepEqual(currentParsed, newVal)) {
|
||||
// const newContent = JSON.stringify(newVal, null, 2)
|
||||
// editorView.value?.dispatch({
|
||||
// changes: {
|
||||
// from: 0,
|
||||
// to: editorView.value.state.doc.length,
|
||||
// insert: newContent
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// },
|
||||
// { deep: true }
|
||||
// )
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(newVal) => {
|
||||
// 当前编辑器内容
|
||||
const currentContent = editorView.value?.state.doc.toString() ?? '';
|
||||
const newContent = JSON.stringify(newVal ?? {}, null, 2);
|
||||
|
||||
if (currentContent !== newContent && editorView.value) {
|
||||
editorView.value.dispatch({
|
||||
changes: {
|
||||
from: 0,
|
||||
to: editorView.value.state.doc.length,
|
||||
insert: newContent
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
|
||||
// 辅助函数:尝试解析 JSON
|
||||
const tryParse = (value: string): any => {
|
||||
|
@ -52,7 +52,6 @@ import { getDefaultValue, normaliseJavascriptType } from '@/hook/mcp';
|
||||
import KInputObject from '@/components/k-input-object/index.vue';
|
||||
import { mcpClientAdapter } from '@/views/connect/core';
|
||||
import { JSONSchemaFaker } from 'json-schema-faker';
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
defineComponent({ name: 'tool-executor' });
|
||||
|
||||
@ -149,6 +148,7 @@ const generateMockData = async () => {
|
||||
// 将 mock 数据绑定到表单
|
||||
Object.keys(mockData).forEach(key => {
|
||||
tabStorage.formData[key] = mockData[key];
|
||||
console.log(mockData[key]);
|
||||
});
|
||||
|
||||
// 如果需要刷新表单校验,可以加上
|
||||
|
Loading…
x
Reference in New Issue
Block a user