wx-starlock/pages/webview/webview.vue
范鹏 5316f1f33c 1. 修改我的页面显示url
2. 添加全局缓存方法,所有缓存添加小程序版本前缀
2024-09-19 11:50:23 +08:00

42 lines
844 B
Vue

<template>
<view>
<web-view :src="url"></web-view>
</view>
</template>
<script>
import env from '@/config/env'
export default {
data() {
return {
url: '',
env: null
}
},
onLoad: async function (options) {
this.env = await env[await getApp().globalData.getEnvConfig()]
const officialAccounts = {
default: {
url: '/app/introduce',
name: '介绍'
},
userAgreement: {
url: '/app/userAgreement',
name: '用户协议'
},
privacy: {
url: '/app/privacy',
name: '隐私政策'
}
}
const item = officialAccounts[options?.type] || officialAccounts['default']
this.url = this.env.webviewBaseUrl + item['url']
console.log(this.url)
uni.setNavigationBarTitle({
title: item['name']
})
}
}
</script>