埋点

 1 function report(params) {
 2   axios
 3     .get('url', { params })
 4     .then(res => {})
 5     .catch(error => {
 6       console.warn(error)
 7     })
 8 }
 9 
10 const events = {
11 main_clicked(json) {  //json是需要传递的参数
12     report(Object.assign({ enentId: '事件ID' }, json))
13   }
14 }
15 
16 
17 export default (function() {
18   return function install(Vue) {
19     Vue.prototype.$buriedPoint = {
20       ...events
21     }
22   }
23 })()

调用:

1  this.$buriedPoint.main_clicked({
2       param1:'',
3      param2:''
4       })
5     }

 

posted on 2019-12-21 10:22  ihuangqing  阅读(289)  评论(0编辑  收藏  举报