You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
2.5 KiB
105 lines
2.5 KiB
import Vue from "vue";
|
|
import App from "./App.vue";
|
|
import router from "./router";
|
|
import store from "./store";
|
|
import ElementUI from "element-ui";
|
|
import "element-ui/lib/theme-chalk/index.css";
|
|
import axios from "axios";
|
|
import JsonExcel from "vue-json-excel"; //vue全局导入导出excel
|
|
import Print from "vue-print-nb";
|
|
import Meta from 'vue-meta'
|
|
|
|
|
|
Vue.use(Meta);
|
|
Vue.use(ElementUI);
|
|
|
|
|
|
console.log('vue',Vue.prototype)
|
|
Vue.prototype.$axios = axios;
|
|
|
|
//全局注册外壳的 peisAPI 对象
|
|
try {
|
|
Vue.prototype.$peisAPI = window.peisAPI;
|
|
} catch (error) {
|
|
Vue.prototype.$peisAPI = null;
|
|
}
|
|
|
|
|
|
Vue.use(Print);
|
|
Vue.component("downloadExcel", JsonExcel);
|
|
Vue.config.productionTip = false;
|
|
|
|
// Vue.filter('format', function (date) {
|
|
// var json_date = new Date(date).toJSON()
|
|
// return new Date(new Date(json_date) + 8 * 3600 * 1000).toISOString().replace(/t/g, '').replace(/\.[\d]{3}Z/, '')
|
|
// })
|
|
Vue.directive('focus', {
|
|
// 当被绑定的元素插入到 DOM 中时
|
|
inserted: function (el) {
|
|
// 聚焦元素
|
|
el.focus()
|
|
},
|
|
update: function (el) {
|
|
// 聚焦元素
|
|
el.focus()
|
|
}
|
|
})
|
|
Vue.filter("dateFormat", (dataStr) => {
|
|
var time = new Date(dataStr);
|
|
|
|
function timeAdd0(str) {
|
|
if (str < 10) {
|
|
str = "0" + str;
|
|
}
|
|
return str;
|
|
}
|
|
var y = time.getFullYear();
|
|
var m = time.getMonth() + 1;
|
|
var d = time.getDate();
|
|
var h = time.getHours();
|
|
var mm = time.getMinutes();
|
|
var s = time.getSeconds();
|
|
return (
|
|
y +
|
|
"-" +
|
|
timeAdd0(m) +
|
|
"-" +
|
|
timeAdd0(d) +
|
|
" " +
|
|
timeAdd0(h) +
|
|
":" +
|
|
timeAdd0(mm) +
|
|
":" +
|
|
timeAdd0(s)
|
|
);
|
|
});
|
|
new Vue({
|
|
router,
|
|
store,
|
|
metaInfo(){
|
|
return {
|
|
title: '神豚体检管理系统',
|
|
meta: [
|
|
{
|
|
name:"http-equiv",
|
|
content: "Content-Security-Policy", //http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline';">
|
|
},{
|
|
name:"content",
|
|
content: "default-src 'self' 'unsafe-inline';", //指向data的数据
|
|
}
|
|
]
|
|
}
|
|
},
|
|
render: (h) => h(App),
|
|
|
|
}).$mount("#app");
|
|
|
|
|
|
//监听页面大小改变
|
|
window.addEventListener('resize', onResize);
|
|
function onResize() {
|
|
//console.log(document.body.clientHeight,'-document.body.clientHeight-',window.innerHeight)
|
|
store.commit('setData', { key: 'window.pageHeight', value: window.innerHeight})
|
|
store.commit('setData', { key: 'window.pageWidth', value: window.innerWidth})
|
|
}
|
|
onResize();
|