fix: 重做是 刷新CurComponent

This commit is contained in:
wangjiahao 2021-06-17 11:56:05 +08:00
parent 4ecb283020
commit 9a8c0d1356
2 changed files with 3 additions and 1 deletions

View File

@ -1,7 +1,7 @@
<!-- TODO: 这个页面后续将用 JSX 重构 -->
<template>
<div class="attr-list">
<el-form label-width="80px">
<el-form label-width="80px" size="mini">
<el-form-item v-for="(key, index) in styleKeys.filter(item => item != 'rotate')" :key="index" :label="map[key]+':'">
<el-color-picker v-if="key == 'borderColor'" v-model="curComponent.style[key]" />
<el-color-picker v-else-if="key == 'color'" v-model="curComponent.style[key]" />

View File

@ -9,6 +9,7 @@ export default {
},
mutations: {
undo(state) {
store.commit('setCurComponent', { component: null, index: null })
if (state.snapshotIndex > 0) {
state.snapshotIndex--
store.commit('setComponentData', deepCopy(state.snapshotData[state.snapshotIndex]))
@ -17,6 +18,7 @@ export default {
},
redo(state) {
store.commit('setCurComponent', { component: null, index: null })
if (state.snapshotIndex < state.snapshotData.length - 1) {
state.snapshotIndex++
store.commit('setComponentData', deepCopy(state.snapshotData[state.snapshotIndex]))