This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
nezha-nezha-fronted/nezha-fronted/src/main.js
wanghaoyu fdd1888577 feat: 功能组件添加
新增axios请求组件http.js,新增国际化组件i18n.js,新增完全分页组件pagination,样式调整
2019-12-04 13:45:37 +08:00

66 lines
1.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import "./assets/css/main.css";
import 'element-ui/lib/theme-chalk/index.css';
import ElementUI from 'element-ui';
import i18n from './components/common/i18n'
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios';
import { post, get} from './http.js'
import Pagination from "./components/common/pagination"; //引入全局分页组件
Vue.component("Pagination", Pagination);
Vue.prototype.$axios = axios
Vue.prototype.$post = post;
Vue.prototype.$get = get;
Vue.config.productionTip = false
Vue.use(ElementUI)
const clickoutside = {
// 初始化指令
bind(el, binding, vnode) {
function documentHandler(e) {
// 这里判断点击的元素是否是本身,是本身,则返回
if (el.contains(e.target)) {
return false;
}
// 判断指令中是否绑定了函数
if (binding.expression) {
// 如果绑定了函数 则调用那个函数此处binding.value就是handleClose方法
if (binding.arg) {
binding.value(e, binding.arg);
} else {
binding.value(e);
}
}
}
// 给当前元素绑定个私有变量方便在unbind中可以解除事件监听
el.__vueClickOutside__ = documentHandler;
document.addEventListener('click', documentHandler);
},
unbind(el, binding) {
// 解除事件监听
document.removeEventListener('click', el.__vueClickOutside__);
delete el.__vueClickOutside__;
},
};
Vue.directive('clickoutside',
clickoutside
)
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
i18n,
components: { App },
template: '<App/>'
})