import Vue from 'vue'



Vue.directive('drag', {
    bind(el, binding, vnode) {
        let dialogHeader = el.querySelector('.ant-modal-header')
        let dialog = el.querySelector('.ant-modal')

        dialogHeader.style.cursor = 'move'

        dialogHeader.onmousedown = (e) => {
            let scale = e.scale || 1; // 或者 e.webkitScale 对于旧版Webkit浏览器

            let startX = dialog.offsetLeft;
            let disX = e.clientX - dialog.offsetLeft * scale;
            let disY = e.clientY - dialog.offsetTop * scale;





            document.onmousemove = (lo) => {

                console.log(dialog.style.left);
                let left = lo.clientX - disX - startX

                let top = lo.clientY / scale - disY

                console.log("aaaa");


                dialog.style.left = left + 'px'
                console.log(dialog.style.left);
                dialog.style.top = top + 'px'

            }


            document.onmouseup = (e) => {
                dialog.style.willChange = 'auto'; // 恢复默认值
                document.onmousemove = null
                document.onmouseup = null
            }
        }
    }
})

import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/antd'
import './plugins/element'
import './components/index'
import './layouts/index'
import utils from './utils/index'
import api from './plugins/axios/index'
Vue.config.productionTip = false
Vue.prototype.$utils = utils
Vue.prototype.$api = api
// import axios from 'axios'
// Vue.prototype.$axios = axios
import { HappyScroll } from 'vue-happy-scroll'
//自定义组件名
Vue.component('happy-scroll', HappyScroll)
// 引入css
import 'vue-happy-scroll/docs/happy-scroll.css'

// 图片预览插件 viewer
import 'viewerjs/dist/viewer.css'
import viewer from 'v-viewer'
// main.js
Vue.use(viewer, {
    defaultOptions: {
        // 其他配置...
        initialRotate: 90, // 初始旋转角度
    },
})


new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')

const vuex = require('vuex');
console.log(vuex);
