import type { PropType } from 'vue'; import { defineComponent, ref } from 'vue'; import { FButton } from '@fesjs/fes-design'; import { javascript } from '@codemirror/lang-javascript'; import type { IJavascriptComputed } from '@webank/letgo-types'; import type { DocumentModel } from '@webank/letgo-designer'; import { CodeEditor } from '../../code-editor'; import './code-edit.less'; import './computed-edit.less'; /** * TODO 待实现功能 * header 区域可编辑 id * header 区域可删除/复制 */ export const ComputedEdit = defineComponent({ name: 'ComputedEdit', props: { documentModel: Object as PropType, hints: Object as PropType>, codeItem: Object as PropType, changeContent: Function as PropType<(id: string, content: Partial) => void>, }, setup(props) { const tmpFuncBody = ref(props.codeItem.funcBody); // TODO 如果进行修改,用户切换其他 code 时进行拦截,提示用户是否要进行保存 const changeFuncBody = (value: string) => { tmpFuncBody.value = value; }; const onSave = () => { props.changeContent(props.codeItem.id, { funcBody: tmpFuncBody.value, }); }; return () => { return (
保存
); }; }, });