const app = getApp() import { userEvent } from '~/api/global' module.exports = Behavior({ data: { isIos: app.globalData.isIOS, }, pageLifetimes: { show() { /*获取当前页url*/ var pages = getCurrentPages() //获取加载的页面 var currentPage = pages[pages.length - 1] //获取当前页面的对象 var url = currentPage.route userEvent({ action: this.data.isIos ? 'PV_IOS' : 'PV_ANDROID', targetContent: url }) }, } })