baimacms/App.vue

47 lines
1.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script>
import UrlQuery from '@/scratch/url-query.js';
export default {
globalData: {
urlParams: {}
},
onLaunch: function(options) {
console.log('App Launch');
// 获取 URL 参数并存入 globalData
let params = UrlQuery.getAll();
// #ifndef H5
// 非 H5 平台,合并 App.onLaunch 的 options.query分享/扫码进入时的参数)
if (options && options.query && typeof options.query === 'object') {
params = { ...params, ...options.query };
}
// #endif
this.globalData.urlParams = params;
console.log('URL 参数:', params);
},
onShow: function(options) {
console.log('App Show');
// 每次显示时更新参数H5 下 URL 可能变化)
let params = UrlQuery.getAll();
// #ifndef H5
if (options && options.query && typeof options.query === 'object') {
params = { ...params, ...options.query };
}
// #endif
this.globalData.urlParams = params;
},
onHide: function() {
console.log('App Hide');
}
}
</script>
<style>
/*每个页面公共css */
</style>