-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
89 lines (78 loc) · 2.25 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import Vue from 'vue';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
//import "./assets/theme/black.css"
import VueRouter from 'vue-router'
import routerconfig from "./urldict.js"
//import routeritem from "./urldictitem.js";
import App from "./App.vue";
import VueTyper from "vue-typer"
import axios from 'axios'
import VueAxios from 'vue-axios';
var errorring="./audio/error.wav"
Vue.use(VueAxios, axios)
Vue.use(VueRouter);
Vue.use(ElementUI);
Vue.use(VueTyper);
window.messagebox=new Vue()
// 方法1:注册播放音频事件到Vue实例上
/*Vue.config.errorHandler = function(err, vm, info) {
if(process.env.NODE_ENV=="production"){
var data="warmagame \nmsg:"+err+"\ninfo:"+info
var t=Vue
t.axios.get('http://hb9.api.yesapi.cn/?s=App.Logger.Record',{
params:{
app_key:"34E95D6F64DEF48A911C7E7DECE32047",
type:"ERROR",
message:data,
}
}).then(()=>{
t.prototype.playAudio()
setTimeout(()=>{
alert('游戏出现了错误,我们已经将错误日志上传到后台服务器。请稍后再试')
},500)
})
}
else{
console.error(err,info)
}
};*/
/*Vue.config.warnHandler = function(msg, vm, trace) {
if(process.env.NODE_ENV=="production"){
var trace=trace
var data="warmagame \nmsg:"+msg+"\ntrace:"+trace
var t=Vue
t.axios.get('http://hb9.api.yesapi.cn/?s=App.Logger.Record',{
params:{
app_key:"34E95D6F64DEF48A911C7E7DECE32047",
type:"ERROR",
message:data,
}
}).then(()=>{
t.prototype.playAudio()
setTimeout(()=>{
alert('游戏出现了错误,我们已经将错误日志上传到后台服务器。请稍后再试')
},500)
})
}
else{
console.error(msg,trace)
}
};*/
const originalReplace = VueRouter.prototype.replace;
VueRouter.prototype.replace = function replace(location) {
return originalReplace.call(this, location).catch(err => err);
};
const router = new VueRouter(
routerconfig // (缩写) 相当于 routes: routes
)
new Vue({
el: '#app',
router,
render: h => h(App),
data(){
return {
blackmode:false
}
}
});