mind-map/web/src/pages/Edit/components/NodeImgPreview.vue
2022-10-19 16:33:09 +08:00

42 lines
720 B
Vue

<template>
<viewer :images="images">
<img v-for="src in images" :key="src" :src="src" />
</viewer>
</template>
<script>
export default {
props: {
mindMap: {
type: Object,
default() {
return null
}
}
},
data() {
return {
images: []
}
},
mounted() {
this.mindMap.on('node_img_dblclick', this.onNodeTmgDblclick)
},
beforeDestroy() {
this.mindMap.off('node_img_dblclick', this.onNodeTmgDblclick)
},
methods: {
onNodeTmgDblclick(node, e) {
e.stopPropagation()
e.preventDefault()
this.images = [node.nodeData.data.image]
this.$viewerApi({
images: this.images
})
}
}
}
</script>
<style></style>