refactor: 优化PC移动端布局切换,防止出现错误仪表板布局

Co-authored-by: wangjiahao <1522128093@qq.com>
This commit is contained in:
fit2cloudrd 2021-12-24 17:54:28 +08:00 committed by GitHub
parent ffb4deb3a9
commit 787ef75b06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 3 deletions

View File

@ -376,6 +376,7 @@ export default {
mobileDataObj[item.id] = item
})
const sourceComponentData = JSON.parse(this.componentDataCache)
this.$store.commit('setComponentDataCache', null)
sourceComponentData.forEach(item => {
if (mobileDataObj[item.id]) {
mobile2MainCanvas(item, mobileDataObj[item.id])

View File

@ -348,6 +348,7 @@ const data = {
},
// 启用移动端布局
openMobileLayout(state) {
state.componentDataCache = null
state.componentDataCache = JSON.stringify(state.componentData)
state.pcComponentData = state.componentData
const mainComponentData = []

View File

@ -645,6 +645,8 @@ export default {
this.lastActiveNodeData = data
this.activeTree = data.panelType
if (data.nodeType === 'panel') {
// pc
this.$store.commit('setComponentDataCache', null)
//
findOne(data.id).then(response => {
const componentDatas = JSON.parse(response.data.panelData)

View File

@ -130,13 +130,11 @@ import { starStatus, saveEnshrine, deleteEnshrine } from '@/api/panel/enshrine'
import bus from '@/utils/bus'
import { queryAll } from '@/api/panel/pdfTemplate'
import ShareHead from '@/views/panel/GrantAuth/ShareHead'
import JsPDF from 'jspdf'
export default {
name: 'PanelViewShow',
components: { Preview, SaveToTemplate, PDFPreExport, ShareHead },
props: {
// eslint-disable-next-line vue/require-default-prop
activeTab: {
type: String,
required: false
@ -208,7 +206,6 @@ export default {
bus.$on('set-panel-show-type', type => {
this.showType = type || 0
})
this.initPdfTemplate()
},
methods: {