安装

import Report from 'paiui/dist/packages/report'
Vue.use(
  new Report({
    url: '/logan-web-api/logan-web/logan/web/upload.json', // 埋点接口
    appId: 'paiui-demo', // 可与app保持一致
    version: '1.0.0', // 应用版本号
    interval: 3000, // 自动report延迟毫秒
  })
)

全局方法

使用方式

// 记录日志
// type:类型
// content:内容,包含channel(园区)、accountId(用户Id)、path(当前路径,默认取location.href的值)
vm.$paiui.report.log(type:Number, content:Object)
//
// 发送日志
// startOrDays:发送日志的开始日期或N天前,默认是今天
// end:发送日志的开始日期,默认是今天
vm.$paiui.report.send([startOrDays:Date|Number, end:Date])
<el-button type="primary" v-on:click="$paiui.report.log(103,{channel:'南方软件园'})">记录日志1</el-button>    
<el-button type="primary" v-on:click="$paiui.report.log(103,{channel:'南方软件园',accountId:'abc'})">记录日志2</el-button>
<el-button type="primary" v-on:click="$paiui.report.log(103,{channel:'南方软件园',accountId:'def',path:'/home'})">记录日志3</el-button>    
<el-button type="primary" v-on:click="$paiui.report.send()">发送日志</el-button>
<el-button type="primary" v-on:click="$paiui.report.send(new Date('2020/07/20'), new Date('2020/07/21'))">发送日志</el-button>
<el-button type="primary" v-on:click="$paiui.report.send(7)">发送日志(N天内)</el-button>

指令v-report

<el-button type="primary" v-report:log="[103,{channel:'南方软件园'}]">记录日志1</el-button>
<el-button type="primary" v-report:log="[103,{channel:'南方软件园',accountId:'abc'}]">记录日志2</el-button>
<el-button type="primary" v-report:log="[103,{channel:'南方软件园',accountId:'def',path:'/home'}]">记录日志3</el-button>
<el-button type="primary" v-report:send>发送日志</el-button>
<el-button type="primary" v-report:send="[new Date('2020/07/20'), new Date('2020/07/21')]">发送日志(指定日期)</el-button>
<el-button type="primary" v-report:send="7">发送日志(N天前)</el-button>
文档更新时间: 2021-05-12 18:39   作者:管理员