event.js 575 B

12345678910111213141516171819202122
  1. const app = getApp()
  2. import {
  3. userEvent
  4. } from '~/api/global'
  5. module.exports = Behavior({
  6. data: {
  7. isIos: app.globalData.isIOS,
  8. },
  9. pageLifetimes: {
  10. show() {
  11. /*获取当前页url*/
  12. var pages = getCurrentPages() //获取加载的页面
  13. var currentPage = pages[pages.length - 1] //获取当前页面的对象
  14. var url = currentPage.route
  15. userEvent({
  16. action: this.data.isIos ? 'PV_IOS' : 'PV_ANDROID',
  17. targetContent: url
  18. })
  19. },
  20. },
  21. })