pref: wangeditor

This commit is contained in:
KUN1007 2023-08-03 16:44:26 +08:00
parent fcf73744e3
commit 20af4d6f66
3 changed files with 33 additions and 6 deletions

View file

@ -60,11 +60,12 @@ onBeforeUnmount(() => {
<template> <template>
<!-- 编辑器 --> <!-- 编辑器 -->
<div class="editor—wrapper"> <div class="editor—wrapper">
<!-- 这里不能用 v-if否则加载不出来 toolBar -->
<Toolbar <Toolbar
class="toolbar-container" class="toolbar-container"
:editor="editorRef" :editor="editorRef"
:mode="$props.isShowAdvance ? 'default' : 'simple'" :mode="$props.isShowAdvance ? 'default' : 'simple'"
v-if="props.isShowToolbar" v-show="props.isShowToolbar"
/> />
<Editor <Editor
:style="editorHeight" :style="editorHeight"

View file

@ -1,13 +1,26 @@
<script setup lang="ts"> <script setup lang="ts">
// Vue
import { defineAsyncComponent } from 'vue'
// //
import WangEditor from '@/components/WangEditor.vue' import WangEditor from '@/components/WangEditor.vue'
// //
import Tags from '@/views/edit/components/Tags.vue' const Tags = defineAsyncComponent(
() => import('@/views/edit/components/Tags.vue')
)
// //
import ReplyPanelBtn from './ReplyPanelBtn.vue' import ReplyPanelBtn from './ReplyPanelBtn.vue'
// store
import { useKUNGalgameTopicStore } from '@/store/modules/topic'
import { storeToRefs } from 'pinia'
// 使 store
const settingsStore = useKUNGalgameTopicStore()
const { isShowAdvance } = storeToRefs(settingsStore)
const props = defineProps(['isReply']) const props = defineProps(['isReply'])
</script> </script>
@ -19,11 +32,14 @@ const props = defineProps(['isReply'])
<div class="title"><h3>回复给 @ 啊这可海星楼主</h3></div> <div class="title"><h3>回复给 @ 啊这可海星楼主</h3></div>
<!-- 回复的编辑器 --> <!-- 回复的编辑器 -->
<div class="content"> <div class="content">
<WangEditor :height="300" /> <WangEditor :height="300" :isShowToolbar="isShowAdvance" />
</div> </div>
<!-- 回复的页脚 --> <!-- 回复的页脚 -->
<div class="footer"> <div class="footer">
<Tags style="margin-top: 10px; margin-bottom: 10px" /> <Tags
style="margin-top: 10px; margin-bottom: 10px"
v-if="isShowAdvance"
/>
<ReplyPanelBtn /> <ReplyPanelBtn />
</div> </div>
</div> </div>

View file

@ -1,6 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import { useKUNGalgameMessageStore } from '@/store/modules/message' import { useKUNGalgameMessageStore } from '@/store/modules/message'
// store
import { useKUNGalgameTopicStore } from '@/store/modules/topic'
import { storeToRefs } from 'pinia'
// 使 store
const settingsStore = useKUNGalgameTopicStore()
const { isShowAdvance } = storeToRefs(settingsStore)
const info = useKUNGalgameMessageStore() const info = useKUNGalgameMessageStore()
// //
@ -22,7 +30,9 @@ const handleSave = () => {
info.info('AlertInfo.edit.draft') info.info('AlertInfo.edit.draft')
} }
const handleShowAdvance = () => {} const handleShowAdvance = () => {
isShowAdvance.value = !isShowAdvance.value
}
</script> </script>
<template> <template>