Background: Different from Android App, ios app cannot force users not to install and use software. Therefore, android App and ios App have different implementation methods. Specific implementation procedures are as follows

Step one:

Create “lyg-popup.vue file” to encapsulate the popover code component as follows:

<template name="protocol-popup"> <view @touchmove.stop.prevent="clear" v-show="showPopup"> <view class="popup_mask" @touchmove.stop.prevent="clear"></view> <view class="popup_content"> <view class="title">{{title}}</view> <view Class =" EXPLain_TEXT "> Please carefully read and fully understand the terms of the Service Agreement and The Privacy Policy, including but not limited to, the access information required to provide you with data, sharing, and other services. <view class="line"> You can read <navigator: URL ="protocolPath" class="path" Hover -class="navigator-hover"> Service Agreement </navigator> and <navigator: URL ="policyPath" class="path" Hover -class="navigator-hover"> Privacy Policy </navigator> for details. If you agree, please click "Agree" to accept our services. < / view > < / view > < the view class = "button" > < view @ tap = "back" > temporarily not using < / view > < view @ tap = "confirm" > agree < / view > < / view > < / view > </view> </template> <script> export default { name: "lyg-popup", props: { title: { type: String, default: }, // protocolPath protocolPath: {type: String}, // policyPath policyPath: {type: String}, policyStorageKey: {type: String} String, default:"has_read_privacy" } }, data() { return { showPopup: false }; }, created: function() { var that = this; // console.log("lyg-popup created"); uni.getStorage({ key: this.policyStorageKey, success: (res) => { if (res.data) { that.showPopup = false; uni.showTabBar({}); } }, fail: function(e) { that.showPopup = true; uni.hideTabBar({}); }}); }, methods: {clear() {return; }, back() { this.$emit('popupState', false) // #ifdef APP-PLUS // plus.runtime.quit(); plus.ios.import("UIApplication").sharedApplication().performSelector("exit"); // #endif}, // Close the box confirm() {this.showPopup = false; this.$emit('popupState', true); uni.setStorage({ key: this.policyStorageKey, data: true }); uni.showTabBar({}); }}}; </script> <style lang="scss"> .popup_mask { position: fixed; bottom: 0; top: 0; left: 0; right: 0; Background: rgba(0, 0, 0, 0.4); transition-property: opacity; The transition - duration: 0.3 s; opacity: 0; z-index: 98; } .popup_mask { opacity: 1; } .popup_content { overflow: hidden; box-sizing: border-box; padding: 40upx 20upx 0 20upx; position: fixed; bottom: 30%; border-radius: 8px; left: 50%; margin-left: -40%; right: 0; min-height: 400upx; background: #ffffff; width: 80%; z-index: 99; .title { text-align: center; font-size: 34upx; padding: 10upx 0 0 0; } .explain_text { font-size: 30upx; padding: 30upx 30upx 40upx 30upx; line-height: 38upx; .line { display: block; .path { color: #007aff; display: inline-block; text-align: center; } } } .button { display: flex; padding: 20upx; align-items: center; font-size: 34upx; justify-content: space-around; border-top: 1upx solid #f2f2f2; view { text-align: center; } } } </style>Copy the code

Step 2:

Introduce your wrapped component to the first page that you need to display when you enter the APP. The first page that my iosAPP enters is the boot page, so introduce the component and the code is as follows:

template:

< lyg-popup@popupState ="popupState" title=" service protocol "protocolPath='/pages/article/index? article_id=7' policyPath='/pages/article/index? article_id=21' policyStorageKey="has_read_privacy"></lyg-popup>Copy the code

script:

import lyg_popup from '@/components/lyg-popup/lyg-popup.vue';
components: {
    lyg_popup
},
popupState(state) {
        console.log(state);
},
Copy the code

Results the following

Tips:

2. Plus.runtime.quit (); 3. 3.plus.ios. Import (“UIApplication”).sharedApplication().performSelector(“exit”); This method is mainly a way to exit an APP from apple