Commit 3e068da7306a4f81ad098fa9be4e4b273e6b4243
1 parent
1f3ed8a9
fix: do not set editingElement null if change tab(not background)
Showing
2 changed files
with
31 additions
and
10 deletions
front-end/h5/src/components/core/editor/edit-panel/background.js
| 1 | +/* | ||
| 2 | + * @Author: ly525 | ||
| 3 | + * @Date: 2019-12-01 18:11:49 | ||
| 4 | + * @LastEditors : ly525 | ||
| 5 | + * @LastEditTime : 2019-12-22 18:09:54 | ||
| 6 | + * @FilePath: /luban-h5/front-end/h5/src/components/core/editor/edit-panel/background.js | ||
| 7 | + * @Github: https://github.com/ly525/luban-h5 | ||
| 8 | + * @Description: Do not edit | ||
| 9 | + * @Copyright 2018 - 2019 luban-h5. All Rights Reserved | ||
| 10 | + */ | ||
| 1 | import propsEditPanel from './props.js' | 11 | import propsEditPanel from './props.js' |
| 12 | +import { mapState, mapActions } from 'vuex' | ||
| 2 | 13 | ||
| 3 | export default { | 14 | export default { |
| 15 | + computed: { | ||
| 16 | + ...mapState('editor', [ | ||
| 17 | + 'editingPage' | ||
| 18 | + ]) | ||
| 19 | + }, | ||
| 20 | + methods: { | ||
| 21 | + ...mapActions('editor', [ | ||
| 22 | + 'setEditingElement' | ||
| 23 | + ]) | ||
| 24 | + }, | ||
| 4 | render () { | 25 | render () { |
| 5 | return <propsEditPanel layout="vertical" /> | 26 | return <propsEditPanel layout="vertical" /> |
| 27 | + }, | ||
| 28 | + created () { | ||
| 29 | + const bgElement = this.editingPage.elements.find(e => e.name === 'lbp-background') | ||
| 30 | + this.setEditingElement(bgElement) | ||
| 31 | + }, | ||
| 32 | + beforeDestroy () { | ||
| 33 | + this.setEditingElement() | ||
| 6 | } | 34 | } |
| 35 | + | ||
| 7 | } | 36 | } |
front-end/h5/src/components/core/editor/index.js
| @@ -111,7 +111,7 @@ export default { | @@ -111,7 +111,7 @@ export default { | ||
| 111 | data: () => ({ | 111 | data: () => ({ |
| 112 | activeMenuKey: 'pluginList', | 112 | activeMenuKey: 'pluginList', |
| 113 | isPreviewMode: false, | 113 | isPreviewMode: false, |
| 114 | - activeTabKey: 'background', | 114 | + activeTabKey: '属性', |
| 115 | previewVisible: false, | 115 | previewVisible: false, |
| 116 | scaleRate: 1 | 116 | scaleRate: 1 |
| 117 | }), | 117 | }), |
| @@ -161,14 +161,6 @@ export default { | @@ -161,14 +161,6 @@ export default { | ||
| 161 | */ | 161 | */ |
| 162 | setActiveTab (activeTabKey) { | 162 | setActiveTab (activeTabKey) { |
| 163 | this.activeTabKey = activeTabKey | 163 | this.activeTabKey = activeTabKey |
| 164 | - switch (activeTabKey) { | ||
| 165 | - case 'background': | ||
| 166 | - const bgElement = this.elements.find(e => e.name === 'lbp-background') | ||
| 167 | - this.setEditingElement(bgElement) | ||
| 168 | - break | ||
| 169 | - default: | ||
| 170 | - this.setEditingElement() | ||
| 171 | - } | ||
| 172 | }, | 164 | }, |
| 173 | _renderMenuContent () { | 165 | _renderMenuContent () { |
| 174 | return ( | 166 | return ( |
| @@ -377,7 +369,7 @@ export default { | @@ -377,7 +369,7 @@ export default { | ||
| 377 | <a-tab-pane label="动画" key='动画' tab={this.$t('editor.editPanel.tab.animation')}><RenderAnimationEditor /></a-tab-pane> | 369 | <a-tab-pane label="动画" key='动画' tab={this.$t('editor.editPanel.tab.animation')}><RenderAnimationEditor /></a-tab-pane> |
| 378 | <a-tab-pane label="动作" key='动作' tab={this.$t('editor.editPanel.tab.action')}>{ this.activeTabKey === '动作' && <RenderActoionEditor/> }</a-tab-pane> | 370 | <a-tab-pane label="动作" key='动作' tab={this.$t('editor.editPanel.tab.action')}>{ this.activeTabKey === '动作' && <RenderActoionEditor/> }</a-tab-pane> |
| 379 | <a-tab-pane label="脚本" key='脚本' tab={this.$t('editor.editPanel.tab.script')}><RenderScriptEditor/></a-tab-pane> | 371 | <a-tab-pane label="脚本" key='脚本' tab={this.$t('editor.editPanel.tab.script')}><RenderScriptEditor/></a-tab-pane> |
| 380 | - <a-tab-pane label="背景" key='background' tab={this.$t('editor.editPanel.tab.background')}><RenderBackgroundEditor/></a-tab-pane> | 372 | + <a-tab-pane label="背景" key='background' tab={this.$t('editor.editPanel.tab.background')}>{ this.activeTabKey === 'background' && <RenderBackgroundEditor/> }</a-tab-pane> |
| 381 | </a-tabs> | 373 | </a-tabs> |
| 382 | </a-layout-sider> | 374 | </a-layout-sider> |
| 383 | 375 |