首页 > 其他分享 >vue在图片上打点功能+旋转摄像头

vue在图片上打点功能+旋转摄像头

时间:2022-09-01 15:35:24浏览次数:45  
标签:打点 vue console 100% 50% markerArr lineindex divdeg 摄像头

<template>     <div class="point">         <div class="mongolia" id="mongolia" @click.stop="creat_point">             <div ref="testDom" class="marker" v-for="(item, index) in markerArr" :key="index"                 :style="{ left: item.x, top: item.y, transform: 'translate(-50%, -50%)' }"                 @click.stop="edit_poit(index)">             </div>         </div>         <div class="console">             <button class="toleft" @click.stop="toleft_poit">向左</button>             <button class="toright" @click.stop="toright_poit">向右</button>             <button class="toright" @click.stop="del_poit">删除</button>         </div>     </div> </template> <script> export default {     name: 'point',     props: {},     data() {         return {             markerArr: [],             lineindex: '',             divdeg: [],             showtrue: false         }     },     methods: {         // 打点         creat_point(e) {             // console.log(e)             e = e || window.event;             let x = e.offsetX || e.layerX;             let y = e.offsetY || e.layerY;             let obj = {                 x: x + 'px',                 y: y + 'px',             }             // console.log(obj)             this.markerArr.push(obj);             this.divdeg.push(0);         },         // 编辑点         edit_poit(index) {             console.log(index, this.markerArr)             this.lineindex = index;             this.showtrue = true         },         //删除点         del_poit() {             if (this.showtrue) {                 console.log(this.markerArr)                 this.markerArr.splice(this.lineindex, 1);                 this.divdeg.splice(this.lineindex, 1);                 this.showtrue = false             } else {                 alert('请选择您要编辑的摄像头');             }
        },         // 向左旋转         toleft_poit() {             this.divdeg[this.lineindex] += 10             this.$refs.testDom[this.lineindex].style.transform = 'translate(-50%, -50%) rotate(' + this.divdeg[this.lineindex] + 'deg)';         },         //向右旋转             toright_poit() {             this.divdeg[this.lineindex] -= 10             this.$refs.testDom[this.lineindex].style.transform = 'translate(-50%, -50%) rotate(' + this.divdeg[this.lineindex] + 'deg)';         }     } } </script> <style  scoped> .point {     width: 50%;     height: 600px; }
.mongolia {     width: 100%;     height: 100%;     background: url('../assets/123asd.png')no-repeat center center;     position: relative; }
.marker {     width: 50px;     height: 50px;     position: absolute;     background: url('../assets/redMark.png')no-repeat center center;     background-size: 100% 100%; }
.marker-son {     width: 100%;     height: 100%;     float: left;
}
.console {     text-align: center;     margin-top: 50px; } </style>

标签:打点,vue,console,100%,50%,markerArr,lineindex,divdeg,摄像头
From: https://www.cnblogs.com/shenbo666/p/16646682.html

相关文章

  • Vue基础5个实用案例
    Vue基础5个实用案例前言本章节怼几个案例供读者小伙伴们练习,写不出东西就是写的少,多写就有思路,案例也懒得去搞CSS了,大家主要锤Vue就可以了。不废话直接上货!案例1:选择登陆......
  • vue3项目-小兔鲜儿笔记-首页04
    1.新了解CSS属性:object-fitobject-fit属性对图片进行剪切,保留原始比例一般用于img标签和video标签。object-fit属性值:fill默认,不保证保持原有比例,内容拉伸......
  • vue项目中main.js使用方法详解
    vue项目中main.js使用方法详解目录第一部分:main.js文件解析第二部分:Vue.use的作用以及什么时候使用Vue.use是什么?(官方文档)Vue.use()什么时候使用?补充:关于main.js方便小技......
  • vue方法中的方法怎么同步顺序执行_vue方法同步(顺序)执行:async/await使用 , 使用async搭
    vue方法中的方法怎么同步顺序执行_vue方法同步(顺序)执行:async/await使用项目中有一个地方需要获取到接口返回值之后根据返回值确定之后执行的步骤,使用async搭配await实......
  • 在vue中进行ElementUI 组件的安装、引入 npm i element-ui -S
    在vue中进行ElementUI组件的安装、引入1.安装、引入elementUIcmd进入vue项目所在文件夹安装elementUInpmielement-ui-S在main.js中引入importElementUI......
  • vue 项目优化
    生成打包报告(vueui可视化面板)通过vue.config.js修改webpack的默认配置 (①chainWebpack通过链式编程的形式,来修改默认的webpack配置②configureWebpa......
  • vue 多页面应用
    1,认识vue页面加载过程在创建多页面之前,还是要先简单地了解一下,vue页面时怎么加载的。我们知道,在Vue-cli中默认目录结构如下:1.项目的依赖模块目录,这个目录很大,因此一......
  • [Vue warn]: Avoid mutating a prop directly since the value will be overwritten w
    报错提示:vue.runtime.esm.js?2b0e:619[Vuewarn]:Avoidmutatingapropdirectlysincethevaluewillbeoverwrittenwhenevertheparentcomponentre-renders.I......
  • vue前端解析Excel表格数据
    引入插件npminstallxlsx--save在组件中使用<template><divid="app"><h3>{{message}}</h3><el-uploadactionaccept=".xlsx,.xls":auto-upload="fa......
  • # vue组件设计的思路
    vue组件设计的思路组件不要嵌套太深,最好是小于三层,一旦深度超过三层,组件间的传值就是变得很复杂,所以也可以多多使用插槽的功能,降低组件之前嵌套的深度.什么时候使......