vue 声明式埋点

1.vue入口,新增命令

2.页面暴露埋点

// 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 Vuex from 'vuex'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import App from './App'
import router from './router'
import store from './components/store'

Vue.config.productionTip = false
Vue.use(ElementUI);
Vue.use(Vuex);

Vue.directive('log', {
  bind(el, binding) {
    el.addEventListener('click', () => {
      console.log(el.id)
      console.log(binding.value)
    }, false);
  }
});
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
<template>
    <div>
      <h1>客户资料</h1>

      <el-button v-log="{page:'customer',event:'click',id:'btn1'}" id="btn1">测试</el-button>
    </div>
</template>

<script>
    export default {
        name: "customer"
    }
</script>

<style scoped>

</style>

 

posted on 2020-03-05 20:08  biind  阅读(578)  评论(0编辑  收藏  举报