1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
router.afterEach(to => { // 动态更改title Vue.nextTick(() => { document.title = to.meta.title }) // IOS下invalid signature if (window.__wxjs_is_wkwebview) { if (window.entryUrl === '' || window.entryUrl === undefined) { var url = `${location.origin}${to.fullPath}` window.entryUrl = url } } }) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
async setJsSign(fn) { const baseUrl = process.env.VUE_APP_BASE_URL === '/' ? '' : process.env.VUE_APP_BASE_URL let url = window.location.origin + baseUrl + this.$route.fullPath if (window.__wxjs_is_wkwebview && window.entryUrl) { url = window.entryUrl } let config = {} let params = { url } await this.getJsSign(params).then(res => (config = res.data)) await Weixin.setJsSign(config) if (typeof fn === 'function') { await fn() } } |