import Vue from 'vue';

import 'normalize.css/normalize.css';

import Element from 'element-ui';

import './styles/element-variables.scss';
import './styles/index.scss';

import winseaUi from './winseaUi';

import App from './App';
import store from './store';
import router from './router';

import './assets/icons';
import './permission';

import '../src/styles/common.scss';

import _ from "lodash";
import dragDialog from "./directive/el-dragDialog";
import Cookies from "js-cookie";
Vue.directive("drag", dragDialog);

Vue.use(Element);
Vue.use(winseaUi);

Vue.config.productionTip = false;

Vue.prototype.compareJson = function(obj1, obj2) {
  if (!isObj(obj1) || !isObj(obj2)) {
    return false;
  }
  const str1 = JSON.stringify(obj1);
  const str2 = JSON.stringify(obj2);
  if (str1.length !== str2.length) {
    return false;
  }
  return str1 === str2;
};
Vue.prototype._ = _;

function isObj(object) {
  return (
    object &&
    typeof object === 'object' &&
    Object.prototype.toString.call(object).toLowerCase() === '[object object]'
  );
}

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
});
