Commit ed4720ea21b22e33c2b4612fec005f41cc74db85

Authored by ly525
1 parent 7f823fcd

clear editing element when click preview mode

front-end/h5/src/components/core/editor/index.js
... ... @@ -111,7 +111,8 @@ export default {
111 111 'saveWork',
112 112 'createWork',
113 113 'fetchWork',
114   - 'setWorkAsTemplate'
  114 + 'setWorkAsTemplate',
  115 + 'setEditingElement'
115 116 ]),
116 117 ...mapActions('loading', {
117 118 updateLoading: 'update'
... ... @@ -223,8 +224,12 @@ export default {
223 224 <a-radio-group
224 225 size="small"
225 226 value={this.isPreviewMode}
226   - onInput={value => {
227   - this.isPreviewMode = value
  227 + onInput={isPreviewMode => {
  228 + this.isPreviewMode = isPreviewMode
  229 + if (isPreviewMode) {
  230 + // 当切换到预览模式的时候,清空当前编辑元素
  231 + this.setEditingElement() // 相当于 setEditingElement(null)
  232 + }
228 233 }}
229 234 >
230 235 <a-radio-button label={false} value={false}>编辑模式</a-radio-button>
... ...