Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Reaction[Reaction@4818]' TypeError: t3.onChange is not a function #9970

Open
lill222 opened this issue Apr 6, 2024 · 1 comment
Open

'Reaction[Reaction@4818]' TypeError: t3.onChange is not a function #9970

lill222 opened this issue Apr 6, 2024 · 1 comment
Labels
fix style Bug or PR related to component's style

Comments

@lill222
Copy link

lill222 commented Apr 6, 2024

实现场景:

vue3 dialog 中集成amis-editor


<template #title>


{{ parameter.title }}

    <span>
      <el-radio-group v-model="viewModel">
        <el-radio-button label="电脑"></el-radio-button>
        <el-radio-button label="手机"></el-radio-button>
      </el-radio-group>
    </span>

    <div>
      <el-button @onclick="onPreview">预览</el-button>
      <el-button type="success" @click="onSave">保存</el-button>
      <el-button type="info" @click="dialogVisible = false">关闭</el-button>
    </div>
  </div>
</template>

<div class="editor-inner">
  <section class="table-page">
    <amisEditor
      class-name="is-fixed"
      :is-mobile="parameter.isMobile"
      :preview="parameter.isPreview"
      theme="cxd"
      :value="parameter.schemaJson"
      :on-change="onPageChange"
      :on-save="onSave"
      :action-options="actionOptions"
    ></amisEditor>
  </section>
</div>
<script setup lang="ts" name="PageAmisEditor"> import { ref } from "vue"; import "amis-editor-core/lib/style.css"; import "amis/lib/themes/cxd.css"; import { applyPureReactInVue } from "veaury"; import { Editor } from "amis-editor"; function onPageChange(v: any): void { console.log(v); } export interface EditorProps { title: string; isMobile?: boolean; //是否手机页面 isPreview?: boolean; //是否预览 schemaJson?: object; //编辑页面的Json } const actionOptions = { showOldEntry: false }; const dialogVisible = ref(false); const viewModel = ref("电脑"); const amisEditor = applyPureReactInVue(Editor); const parameter = ref({ title: "页面编辑", isMobile: false, isPreview: false, schemaJson: { type: "page", title: "Simple Form Page", body: [ { type: "form", title: "", body: [ { type: "input-text", name: "a", label: "Text" } ] } ] } }); const acceptParams = (params: EditorProps) => { parameter.value = { ...parameter.value, ...params }; dialogVisible.value = true; }; const onPreview = () => { console.log(parameter.value.isPreview); // parameter.value.isPreview = !parameter.value.isPreview; }; const onSave = () => { console.log("save...."); console.log(amisEditor); }; defineExpose({ acceptParams }); </script> <style scoped lang="scss"> .custom-title { display: flex; align-items: center; justify-content: space-between; } .editor-inner { position: relative !important; flex: 1 1 auto !important; overflow: auto !important; } </style>

存在的问题:

:on-change="onPageChange" 一直报错,像save一样定义也报一样的错误

@github-actions github-actions bot added fix style Bug or PR related to component's style labels Apr 6, 2024
Copy link

github-actions bot commented Apr 6, 2024

👍 Thanks for this!
🏷 I have applied any labels matching special text in your issue.

Please review the labels and make any necessary changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix style Bug or PR related to component's style
Projects
None yet
Development

No branches or pull requests

1 participant