You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
2.1 KiB
Vue
86 lines
2.1 KiB
Vue
<template>
|
|
<div
|
|
:style="{width:props.dimensions.width*props.ratioWidth+'px',height:props.dimensions.height*props.ratioHeight+'px'}">
|
|
<NodeResizer @resizeEnd="(e) => $emit('resize', e)" color="#fff" v-if="!props.isView && !props.isHideHandle && props.selected"
|
|
@resize="resize" />
|
|
|
|
<div class="custom-node"
|
|
:style="{width:props.dimensions.width*props.ratioWidth+'px',height:props.dimensions.height*props.ratioHeight+'px',pointerEvents:props.isView?'auto': 'none'}">
|
|
|
|
<video autoplay muted playsinline :width="props.dimensions.width" :height="props.dimensions.height" controls
|
|
v-if="videoShow">
|
|
<source :src="props.inputData?.videoSrc ||props.data.options.videoSrc" type="video/mp4">
|
|
您的浏览器不支持播放视频。
|
|
</video>
|
|
</div>
|
|
<Handle v-if="!props.isView" :id="`${props.id}.-t`" type="target" :position="Position.Left" />
|
|
</div>
|
|
</template>
|
|
<script setup>
|
|
import { defineEmits, defineProps, ref } from 'vue';
|
|
import { NodeResizer } from '@vue-flow/node-resizer';
|
|
import { Handle, Position } from '@vue-flow/core';
|
|
|
|
const videoShow = ref(true);
|
|
const props = defineProps({
|
|
ratioWidth: {
|
|
type: Number,
|
|
required: false,
|
|
default: 1
|
|
},
|
|
ratioHeight: {
|
|
type: Number,
|
|
required: false,
|
|
default: 1
|
|
},
|
|
isView: {
|
|
type: Boolean,
|
|
required: false
|
|
},
|
|
inputData: {
|
|
type: Object,
|
|
required: false
|
|
},
|
|
id: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
isHideHandle: {
|
|
type: Boolean,
|
|
required: false
|
|
},
|
|
selected: {
|
|
type: Boolean,
|
|
required: false
|
|
},
|
|
data: {
|
|
type: Object,
|
|
required: true
|
|
},
|
|
dimensions: {
|
|
type: Object,
|
|
required: true
|
|
}
|
|
});
|
|
|
|
watch(() => JSON.parse(JSON.stringify([props.data?.options?.videoSrc, props.inputData?.videoSrc])), (obj1, obj2) => {
|
|
if (JSON.stringify(obj1) !== JSON.stringify(obj2)) {
|
|
videoShow.value = false;
|
|
nextTick(() => {
|
|
videoShow.value = true;
|
|
});
|
|
}
|
|
}, { deep: true, immediate: true });
|
|
|
|
const emit = defineEmits(['resize']);
|
|
const resize = (e) => {
|
|
emit('resize', e, props.id);
|
|
};
|
|
</script>
|
|
<style scoped>
|
|
.custom-node {
|
|
position: absolute;
|
|
}
|
|
</style>
|
|
|