dataease-dm/frontend/src/views/link/view/index.vue

57 lines
1.1 KiB
Vue
Raw Normal View History

2021-03-25 18:58:05 +08:00
<template>
2021-04-20 11:21:53 +08:00
<div style="width: 100%;height: 100%;background-color: #f7f8fa">
<Preview v-if="show" />
2021-03-25 18:58:05 +08:00
</div>
</template>
<script>
2021-04-20 11:21:53 +08:00
import { loadResource } from '@/api/link'
import { uuid } from 'vue-uuid'
import Preview from '@/components/canvas/components/Editor/Preview'
2021-03-25 18:58:05 +08:00
export default {
name: 'LinkView',
2021-04-20 11:21:53 +08:00
components: { Preview },
props: {
resourceId: {
type: String,
default: null
}
},
2021-03-25 18:58:05 +08:00
data() {
return {
2021-04-20 11:21:53 +08:00
show: false
2021-03-25 18:58:05 +08:00
}
},
2021-04-20 11:21:53 +08:00
created() {
this.show = false
this.setPanelInfo()
},
2021-03-25 18:58:05 +08:00
methods: {
2021-04-20 11:21:53 +08:00
setPanelInfo() {
loadResource(this.resourceId).then(res => {
this.$store.commit('setComponentData', this.resetID(JSON.parse(res.data.panelData)))
// this.$store.commit('setComponentData', JSON.parse(res.data.panelData))
this.$store.commit('setCanvasStyle', JSON.parse(res.data.panelStyle))
this.show = true
})
},
resetID(data) {
2021-05-05 22:14:23 +08:00
if( data ) {
data.forEach(item => {
item.id = uuid.v1()
})
}
2021-04-20 11:21:53 +08:00
return data
}
2021-03-25 18:58:05 +08:00
}
}
</script>
2021-04-20 11:21:53 +08:00
<style scoped>
*{
margin: 0;
padding: 0;
}
</style>