|
|
@@ -0,0 +1,69 @@
|
|
|
+<template>
|
|
|
+ <div :style="getStyle(borderRadius)">
|
|
|
+ <video
|
|
|
+ class="video-background"
|
|
|
+ preload="auto"
|
|
|
+ loop
|
|
|
+ playsinline
|
|
|
+ autoplay
|
|
|
+ muted
|
|
|
+ src="https://video.699pic.com/videos/76/09/36/b_D4DKnb48qdCI1631760936.mp4"
|
|
|
+ :width="w"
|
|
|
+ :height="h"
|
|
|
+ ></video>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup lang="ts">
|
|
|
+import { PropType, shallowReactive, watch, toRefs } from 'vue'
|
|
|
+import { useChartDataFetch } from '@/hooks'
|
|
|
+import { CreateComponentType } from '@/packages/index.d'
|
|
|
+import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
|
|
+import { option } from './config'
|
|
|
+
|
|
|
+const props = defineProps({
|
|
|
+ chartConfig: {
|
|
|
+ type: Object as PropType<CreateComponentType>,
|
|
|
+ required: true
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const { w, h } = toRefs(props.chartConfig.attr)
|
|
|
+const { dataset, fit, borderRadius } = toRefs(props.chartConfig.option)
|
|
|
+
|
|
|
+const option = shallowReactive({
|
|
|
+ dataset: ''
|
|
|
+})
|
|
|
+
|
|
|
+const getStyle = (radius: number) => {
|
|
|
+ return {
|
|
|
+ borderRadius: `${radius}px`,
|
|
|
+ overflow: 'hidden'
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 编辑更新
|
|
|
+watch(
|
|
|
+ () => props.chartConfig.option.dataset,
|
|
|
+ (newData: any) => {
|
|
|
+ option.dataset = newData
|
|
|
+ },
|
|
|
+ {
|
|
|
+ immediate: true,
|
|
|
+ deep: false
|
|
|
+ }
|
|
|
+)
|
|
|
+
|
|
|
+// 预览更新
|
|
|
+useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => {
|
|
|
+ option.dataset = newData
|
|
|
+})
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.video-background {
|
|
|
+ object-fit: cover;
|
|
|
+ mix-blend-mode: screen;
|
|
|
+ opacity: 1;
|
|
|
+}
|
|
|
+</style>
|