拖拽two
     .one,.two{  height:100px;  width:100px;  border:1px solid #000;  position: absolute;  -webkit-user-select: none;  -ms-user-select: none;  -moz-user-select: -moz-none;  cursor: pointer;  }  .two{  left:200px;  }  拖拽one  拖拽two [javascript] view plain copy print?Vue.directive('drag', {    inserted:function(el){      el.onmousedown=function(e){        let l=e.clientX-el.offsetLeft;        let t=e.clientY-el.offsetTop;        document.onmousemove=function(e){          el.style.left=e.clientX-l+'px';          el.style.top=e.clientY-t+'px';        };        el.onmouseup=function(){          document.onmousemove=null;          el.onmouseup=null;        }      }    }  })  new Vue({    el:'#app'  });

上述内容就是如何在Vue项目中使用directive()函数,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注创新互联行业资讯频道。


文章题目:如何在Vue项目中使用directive()函数
网站路径:http://tjjierui.cn/article/jopdsd.html