实现可拖动弹窗。
import elDragDialog from '../index.js'
- directives: {
- elDragDialog
- },
二、index.js文件代码
-
- import drag from './drag'
-
- const install = function(Vue) {
- Vue.directive('el-drag-dialog', drag)
- }
-
- if (window.Vue) {
- window['el-drag-dialog'] = drag
- Vue.use(install); // eslint-disable-line
- }
-
- drag.install = install
- export default drag
-
-
三、drag.js文件代码
- export default {
- bind(el, binding, vnode) {
- const dialogHeaderEl = el.querySelector('.el-dialog__header')
- const dragDom = el.querySelector('.el-dialog')
- dialogHeaderEl.style.cssText += ';cursor:move;'
- dragDom.style.cssText += '