App.vue 1.5 KB
Newer Older
1
<script>
DCloud_JSON's avatar
DCloud_JSON 已提交
2
	import initApp from '@/common/appInit.js';
3 4
	import openApp from '@/common/openApp.js';
	import checkIsAgree from '@/pages/uni-agree/utils/uni-agree.js';
5 6 7
	export default {
		globalData: {
			searchText: '',
DCloud_JSON's avatar
DCloud_JSON 已提交
8
			appVersion: {},
9 10 11
			config: {},
			$i18n: {},
			$t: {}
12
		},
13
		onLaunch: function() {
DCloud_JSON's avatar
DCloud_JSON 已提交
14
			console.log('App Launch')
15 16 17 18
			
			this.globalData.$i18n = this.$i18n
			this.globalData.$t = str => this.$t(str)

19 20 21 22 23
			initApp();
			
			// #ifdef H5
				openApp() //创建在h5端全局悬浮引导用户下载app的功能
			// #endif
DCloud_JSON's avatar
DCloud_JSON 已提交
24
			// #ifdef APP-PLUS
25
			//checkIsAgree(); APP端暂时先用原生默认生成的。目前,自定义方式启动vue界面时,原生层已经请求了部分权限这并不符合国家的法规
26
			// #endif
27

28 29
			// #ifdef H5
			// checkIsAgree(); // 默认不开启。目前全球,仅欧盟国家有网页端同意隐私权限的需要。如果需要
30 31
			// #endif

32
			// #ifdef APP-PLUS
33 34 35 36 37 38 39 40 41 42 43 44
			//idfa有需要的用户在应用首次启动时自己获取存储到storage中
			//https://ask.dcloud.net.cn/article/36107
			/*if(~plus.storage.getItem('idfa')){
				plus.device.getInfo({//需要勾选IDFA
					success:function(e){  
						console.log('idfa =  '+JSON.stringify(e.idfa));  
					},
					fail:function(e){
						console.log('getDeviceInfo failed: '+JSON.stringify(e));  
					}  
				});
			}*/
45
			// #endif
46 47
		},
		onShow: function() {
48
			console.log('App Show')
49 50 51 52 53 54 55 56 57
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
58
</style>