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
90
91
92
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import MintUI from 'mint-ui'
import VueClipboard from 'vue-clipboard2'
import sa from 'sa-sdk-javascript';
import 'mint-ui/lib/style.css'
import scroll from "./base/scroll/scroll"
import { Popup, Lazyload, Button, Dialog, Toast } from 'vant';
// import VConsole from "VConsole"
// import Vant from 'vant';
Vue.config.productionTip = false;
Vue.prototype.$sa = sa;
Vue.prototype.$sa.init({
server_url: 'http://47.107.250.38:8106/sa?project=' + (process.env.NODE_ENV === 'production' ? "production" : "default"), // 替换成自己的神策地址
show_log: false,// 打印console,自己配置,可以看到自己是否踩点成功,以及
heatmap: {
//是否开启点击图,默认 default 表示开启,自动采集 $WebClick 事件,可以设置 'not_collect' 表示关闭
clickmap: 'default',
//是否开启触达注意力图,默认 default 表示开启,自动采集 $WebStay 事件,可以设置 'not_collect' 表示关闭
scroll_notice_map: 'default',
},
is_track_single_page: true
});
Vue.prototype.$sa.quick('autoTrack')
Vue.use(MintUI);
Vue.use(VueClipboard);
// Vue.use(Vant);
Vue.use(Popup).use(Lazyload).use(Button).use(Dialog).use(Toast);
Vue.component('scroll', scroll);
// const errorHandler = (error, vm)=>{
// console.error('抛出全局异常');
// console.error(vm);
// console.error(error);
// }
// Vue.config.errorHandler = errorHandler;
// Vue.prototype.$throw = (error)=> errorHandler(error,this);
/* eslint-disable no-new */
// if(process.env.NODE_ENV != 'production'){
// var vConsole = new VConsole();
// }
router.beforeEach((to, from, next) => {
next()
// chrome
console.log(document.body.hasOwnProperty('scrollTop'))
if (document.body.scrollTop !== null) {
document.body.scrollTop = 0
}
// firefox
if (document.documentElement !== null) {
document.documentElement.scrollTop = 0
}
// // safari
// if (window.pageYOffset !== undefined){
// window.pageYOffset = 0
// }
})
new Vue({
el: '#app',
router,
store,
components: { App },
template: '<App/>'
});
if (!Array.prototype.find) {
Array.prototype.find = function (predicate) {
'use strict';
if (this == null) {
throw new TypeError('Array.prototype.find called on null or undefined');
}
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var list = Object(this);
var length = list.length >>> 0;
var thisArg = arguments[1];
var value;
for (var i = 0; i < length; i++) {
value = list[i];
if (predicate.call(thisArg, value, i, list)) {
return value;
}
}
return undefined;
};
}