fix: 🐛 删除Editor双向绑定,改为props传参

This commit is contained in:
chenkl
2020-12-24 16:55:31 +08:00
parent 5142e6e323
commit c395e27f67
32 changed files with 53 additions and 167 deletions

View File

@@ -48,7 +48,7 @@
</el-col>
<el-col :span="24">
<el-form-item prop="content" label="内容">
<editor v-model:value="form.content" />
<editor ref="editorRef" :value="form.content" />
</el-form-item>
</el-col>
</el-row>
@@ -87,6 +87,7 @@ export default defineComponent({
emits: ['close', 'success'],
setup(props, { emit }) {
const formRef = ref<HTMLElement | null>(null)
const editorRef = ref<HTMLElement | null>(null)
const subLoading = ref<boolean>(false)
const form = reactive<InfoWriteParams>({
@@ -136,6 +137,8 @@ export default defineComponent({
// 新增或者编辑
function setListData() {
const formRefWrap = unref(formRef as any)
const editorRefWrap = unref(editorRef as any)
form.content = editorRefWrap.getHtml()
try {
subLoading.value = true
formRefWrap.validate(async(valid: boolean) => {
@@ -166,7 +169,7 @@ export default defineComponent({
}
return {
formRef,
formRef, editorRef,
subLoading,
form,
rules,

View File

@@ -1,7 +1,7 @@
<template>
<div>
<div class="search__example--wrap">
<search
<com-search
:data="searchData"
@search-submit="searchSubmit"
@reset-submit="resetSubmit"
@@ -58,8 +58,6 @@
<script lang="ts">
import { defineComponent, ref } from 'vue'
import ComTable from '_c/Table/index.vue'
import Search from '_c/Search/index.vue'
import IfnoWrite from './components/IfnoWrite.vue'
import { useExample } from '@/hooks/useExample'
@@ -116,8 +114,6 @@ const columns = [
export default defineComponent({
// name: 'Example',
components: {
ComTable,
Search,
IfnoWrite
},
setup() {