Skip to content

Commit

Permalink
fix: codemirrir数据绑定有问题
Browse files Browse the repository at this point in the history
  • Loading branch information
haixin-fang committed Mar 19, 2024
1 parent 42669d1 commit fba8398
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "starfish-editor",
"version": "1.1.12",
"version": "1.1.13",
"main": "dist/starfish-editor.umd.js",
"style": "dist/style.css",
"module": "dist/starfish-editor.es.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/editor/src/common/jsonCode.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<codemirror
:value="internalValue"
v-model="internalValue"
@input="onUpdateValue($event.target.innerText)"
placeholder="json导入"
mode="text/json"
Expand All @@ -24,7 +24,7 @@ export default defineComponent({
emits: ["update:value"], // 定义emit事件名称
setup(props, context) {
const extensions = [json()];
const internalValue = ref(""); // 内部状态变量
const internalValue = ref(props.value); // 内部状态变量
function updateInternalValue(newVal) {
internalValue.value = newVal;
Expand Down
1 change: 0 additions & 1 deletion packages/editor/src/components/PropsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ export default defineComponent({
formStore?.setSave(ispreview as boolean);
formStore?.setFormUpdate(false);
if (ispreview) {
debugger;
const result: BaseComponentItem[] = initFormToJson(allFormList.value);
formStore?.set("AllFormResult", result);
formStore?.handleDynamicForm();
Expand Down
43 changes: 43 additions & 0 deletions playground/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,54 @@ export {}

declare module 'vue' {
export interface GlobalComponents {
ElAlert: typeof import('element-plus/es')['ElAlert']
ElAside: typeof import('element-plus/es')['ElAside']
ElButton: typeof import('element-plus/es')['ElButton']
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup']
ElCol: typeof import('element-plus/es')['ElCol']
ElCollapse: typeof import('element-plus/es')['ElCollapse']
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
ElContainer: typeof import('element-plus/es')['ElContainer']
ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
ElDivider: typeof import('element-plus/es')['ElDivider']
ElDrawer: typeof import('element-plus/es')['ElDrawer']
ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
ElEmpty: typeof import('element-plus/es')['ElEmpty']
ElFooter: typeof import('element-plus/es')['ElFooter']
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElHeader: typeof import('element-plus/es')['ElHeader']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElInput: typeof import('element-plus/es')['ElInput']
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
ElMain: typeof import('element-plus/es')['ElMain']
ElOption: typeof import('element-plus/es')['ElOption']
ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElRow: typeof import('element-plus/es')['ElRow']
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElSlider: typeof import('element-plus/es')['ElSlider']
ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs']
ElTimeSelect: typeof import('element-plus/es')['ElTimeSelect']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTree: typeof import('element-plus/es')['ElTree']
ElUpload: typeof import('element-plus/es')['ElUpload']
Form: typeof import('./src/components/Form.vue')['default']
Home: typeof import('./src/components/Home.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
}
export interface ComponentCustomProperties {
vLoading: typeof import('element-plus/es')['ElLoadingDirective']
}
}
2 changes: 1 addition & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@element-plus/icons-vue": "^2.0.8",
"element-plus": "^2.2.12",
"starfish-editor": "^1.1.12",
"starfish-editor": "^1.1.13",
"starfish-form": "^1.2.7",
"vite": "^4.5.2",
"vue": "^3.2.37",
Expand Down

0 comments on commit fba8398

Please sign in to comment.