没有合适的资源?快使用搜索试试~ 我知道了~
首页Vue-drag-resize 拖拽缩放插件的使用(简单示例)
Vue-drag-resize 拖拽缩放插件的使用(简单示例)
4.4k 浏览量
更新于2023-05-25
评论
收藏 40KB PDF 举报
本文通过代码给大家介绍了Vue-drag-resize 拖拽缩放插件使用简单示例,代码简单易懂,非常不错,具有一定的参考借鉴价值,需要的朋友可以参考下
资源详情
资源评论
资源推荐

Vue-drag-resize 拖拽缩放插件的使用拖拽缩放插件的使用(简单示例简单示例)
本文通过代码给大家介绍了Vue-drag-resize 拖拽缩放插件使用简单示例,代码简单易懂,非常不错,具有一定的
参考借鉴价值,需要的朋友可以参考下
字幕
<div id="lBox" style="background-color: #D7E9F5;"
:style="{'height': parentHeight + 'px', 'width': parentWidth + 'px'}">
<drag-resize v-for="(rect,index) in texts"
style="overflow: hidden;"
:w="rect.BoxWidth"
:h="rect.BoxHeight"
:x="rect.BoxLeft"
:y="rect.BoxTop"
@resizing="textResize($event, index)"
@dragging="textResize($event, index)">
<div style="width: 100%; height: 100%;"
:style={backgroundColor:rect.BoxColor,opacity:rect.BoxOpacity}>
</div><!-- 控制背景色及背景透明度 使背景透明度不影响字幕 -->
<div style="width: 100%; height: 100%;">
<p :class="rect.Direction === 'Left to Right' ? 'roll-right' : 'roll-left'"
style="width: 100%; position:absolute; bottom:-0.25em;left:0px"
:style="{color: rect.TextColor,fontFamily: rect.FontFile,
fontSize: rect.FontSize+'px',
opacity:rect.FontOpacity,
animationDuration: rect.Speed + 's'}">
{{rect.Text}}
</p>
</div>
</drag-resize>
logo
<drag-resize v-for="(rect,index) in logos"
:parentLimitation="true"
:w="rect.Width"
:h="rect.Height"
:x="rect.Left"
:y="rect.Top"
@resizing="logoResize($event, index)"
@dragging="logoResize($event, index)">
<div style="width: 100%;height: 100%;">
<img :src="'/logos/' + rect.FileName"
style="width: 100%;height: 100%;">
</div>
</drag-resize>
</div>
JS
textResize(newRect, index) {
const BoxWidth = newRect.width+''
this.texts[index].BoxWidth = BoxWidth.substring(0, BoxWidth.indexOf("."))
const BoxHeight = newRect.height+''
this.texts[index].BoxHeight = BoxHeight.substring(0, BoxHeight.indexOf("."))
const BoxTop = newRect.top+''
this.texts[index].BoxTop = BoxTop.substring(0, BoxTop.indexOf("."))
const BoxLeft = newRect.left+''
this.texts[index].BoxLeft = BoxLeft.substring(0, BoxLeft.indexOf("."))
}
logoResize(newRect, index) {
const Width = newRect.width''
this.logos[index].Width = Width.substring(0, Size.indexOf("."))
const Height = newRect.height+''
this.logos[index].Height = Height .substring(0, Size.indexOf("."))


















安全验证
文档复制为VIP权益,开通VIP直接复制

评论0