Commit 94594a01dc7b27eb0d0b3f064f67801f190fa0c5
1 parent
115893d7
fix(edtor) switch between page
Showing
2 changed files
with
19 additions
and
9 deletions
front-end/h5/src/components/core/editor/index.js
| ... | ... | @@ -108,6 +108,7 @@ export default { |
| 108 | 108 | }), |
| 109 | 109 | computed: { |
| 110 | 110 | ...mapState('editor', { |
| 111 | + editingPage: state => state.editingPage, | |
| 111 | 112 | editingElement: state => state.editingElement, |
| 112 | 113 | elements: state => state.editingPage.elements, |
| 113 | 114 | pages: state => state.work.pages, |
| ... | ... | @@ -123,7 +124,8 @@ export default { |
| 123 | 124 | 'createWork', |
| 124 | 125 | 'fetchWork', |
| 125 | 126 | 'setWorkAsTemplate', |
| 126 | - 'setEditingElement' | |
| 127 | + 'setEditingElement', | |
| 128 | + 'setEditingPage' | |
| 127 | 129 | ]), |
| 128 | 130 | ...mapActions('loading', { |
| 129 | 131 | updateLoading: 'update' |
| ... | ... | @@ -148,7 +150,16 @@ export default { |
| 148 | 150 | case sidebarMenus[1].value: |
| 149 | 151 | return ( |
| 150 | 152 | this.pages.map((page, index) => ( |
| 151 | - <span style={{ display: 'flex', justifyContent: 'space-between', padding: '12px 0' }}> | |
| 153 | + <span | |
| 154 | + style={{ | |
| 155 | + display: 'flex', | |
| 156 | + justifyContent: 'space-between', | |
| 157 | + padding: '12px 0', | |
| 158 | + color: page.uuid === this.editingPage.uuid ? '#1593ff' : '' | |
| 159 | + }} | |
| 160 | + class="cursor-pointer" | |
| 161 | + onClick={() => { this.setEditingPage(index) }} | |
| 162 | + > | |
| 152 | 163 | {/* #!en: Page<Index> */} |
| 153 | 164 | {/* #!zh: 第<Index>页面 */} |
| 154 | 165 | <span>{this.$t('editor.pageManager.title', { index })}</span> |
| ... | ... | @@ -282,7 +293,7 @@ export default { |
| 282 | 293 | <div style={{ fontSize: '12px', textAlign: 'center' }}>{this.scaleRate * 100}%</div> |
| 283 | 294 | </a-button-group> |
| 284 | 295 | </a-layout-sider> |
| 285 | - <a-layout-sider width="340" theme='light' style={{ background: '#fff', padding: '0 12px' }}> | |
| 296 | + <a-layout-sider width="380" theme='light' style={{ background: '#fff', padding: '0 12px' }}> | |
| 286 | 297 | <a-tabs |
| 287 | 298 | style="height: 100%;" |
| 288 | 299 | tabBarGutter={10} |
| ... | ... | @@ -294,7 +305,7 @@ export default { |
| 294 | 305 | ElementUI:label |
| 295 | 306 | Ant Design Vue:tab |
| 296 | 307 | */} |
| 297 | - <a-tab-pane key="属性"><span slot="tab"><a-icon type="apple" />{this.$t('editor.editPanel.tab.prop')}</span><RenderPropsEditor/></a-tab-pane> | |
| 308 | + <a-tab-pane key="属性"><span slot="tab">{this.$t('editor.editPanel.tab.prop')}</span><RenderPropsEditor/></a-tab-pane> | |
| 298 | 309 | <a-tab-pane label="动画" key='动画' tab={this.$t('editor.editPanel.tab.animation')}><RenderAnimationEditor /></a-tab-pane> |
| 299 | 310 | <a-tab-pane label="动作" key='动作' tab={this.$t('editor.editPanel.tab.action')}>{ this.activeTabKey === '动作' && <RenderActoionEditor/> }</a-tab-pane> |
| 300 | 311 | <a-tab-pane label="脚本" key='脚本' tab={this.$t('editor.editPanel.tab.script')}><RenderScriptEditor/></a-tab-pane> | ... | ... |
front-end/h5/src/store/modules/page.js
| ... | ... | @@ -2,8 +2,8 @@ import Page from '../../components/core/models/page' |
| 2 | 2 | |
| 3 | 3 | // actions |
| 4 | 4 | export const actions = { |
| 5 | - setEditingPage ({ commit }, payload) { | |
| 6 | - commit('setEditingPage', payload) | |
| 5 | + setEditingPage ({ commit }, pageIndex = 0) { | |
| 6 | + commit('setEditingPage', pageIndex) | |
| 7 | 7 | }, |
| 8 | 8 | pageManager ({ commit }, payload) { |
| 9 | 9 | commit('pageManager', payload) |
| ... | ... | @@ -12,9 +12,8 @@ export const actions = { |
| 12 | 12 | |
| 13 | 13 | // mutations |
| 14 | 14 | export const mutations = { |
| 15 | - setEditingPage (state, payload) { | |
| 16 | - payload = payload || state.work.pages[0] | |
| 17 | - state.editingPage = payload | |
| 15 | + setEditingPage (state, pageIndex = 0) { | |
| 16 | + state.editingPage = state.work.pages[pageIndex] | |
| 18 | 17 | }, |
| 19 | 18 | pageManager (state, { type, value }) { |
| 20 | 19 | switch (type) { | ... | ... |