国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

uniapp_05_權(quán)限檢測和跳轉(zhuǎn)到設(shè)置

這篇具有很好參考價(jià)值的文章主要介紹了uniapp_05_權(quán)限檢測和跳轉(zhuǎn)到設(shè)置。希望對大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

關(guān)于 uniapp 權(quán)限申請和跳轉(zhuǎn)系統(tǒng)頁面

  • 測試環(huán)境
  • 查詢權(quán)限
  • 跳轉(zhuǎn)到應(yīng)用詳情
  • 跳轉(zhuǎn)到系統(tǒng)設(shè)置
  • 參考

測試環(huán)境

  • Android 測試環(huán)境1:雷電模擬器 HUAWEI LIO-AN00 系統(tǒng)版本 9
  • Android 測試環(huán)境2:1+ace2 系統(tǒng)版本 13

查詢權(quán)限

uni.authorize 獲取權(quán)限只支持微信小程序不支持app,只能用 Native.js 來實(shí)現(xiàn)

  1. android 查詢權(quán)限

    • 安卓

      太多不想寫

    • uniapp

      plus.android.requestPermissions(permissions, successCb, errorCB)

      • permissions: 需要查詢的權(quán)限數(shù)組 ps 此文中只封裝了一次查詢一個(gè)權(quán)限,需要的自己改
      • successCb:成功回調(diào) 有三個(gè)參數(shù)
        • granted - Array[String]字符串?dāng)?shù)組,已獲取權(quán)限列表
        • deniedPresent - Array[String]字符串?dāng)?shù)據(jù),已拒絕(臨時(shí))的權(quán)限列表
        • deniedAlways - Array[String]字符串?dāng)?shù)據(jù),永久拒絕的權(quán)限列表
      • errorCB: 失敗回調(diào)
        // permissionID:傳入對應(yīng)的權(quán)限常量
        // 1: 授權(quán) -1:永久拒絕 0:暫時(shí)拒絕
        requestAndroidPermission(permissionID) {
            return new Promise((resolve, reject)=>{
                plus.android.requestPermissions(
                    [permissionID],
                    (res)=>{
                        const { granted, deniedPresent, deniedAlways } = res;
                        if(granted.length) resolve(1);
                        if(deniedPresent.length) resolve(0);
                        if(deniedAlways.length) resolve(-1);
                    },
                    (err)=>{ resolve({...err})}
                )
            })
        }
    
  2. android 只驗(yàn)證權(quán)限

    • 安卓

      網(wǎng)上講驗(yàn)證的 api 是 android.support.v4.content.ContextCompat 下面的 checkSelfPermission 方法,但是我導(dǎo)入后,使用時(shí)報(bào)錯(cuò)提示沒有這個(gè)方法。查找文檔之后發(fā)現(xiàn)在 android.core.app.ActivityCompat 下存在 checkSelfPermission 方法但是導(dǎo)入后使用,依舊報(bào)錯(cuò)。仔細(xì)看包之后發(fā)現(xiàn) content,ActivityCompat 有些方法好像被 Native.js 整合進(jìn)入 plus.android.runtimeMainActivity() 里面了,這樣的話等下我想下我以前是不是導(dǎo)入了很多不需要導(dǎo)入的包emmm

    • uniapp

      plus.android.runtimeMainActivity().checkSelfPermission('權(quán)限')
      返回: 0: 無授權(quán) 1: 以授權(quán)

          // 驗(yàn)證是否存在定位權(quán)限
          const main = plus.android.runtimeMainActivity();
          main.checkSelfPermission('android.permission.ACCESS_FINE_LOCATION')
      
  3. ios 查詢權(quán)限

    看最后的代碼,很煩要導(dǎo)入不同的包

跳轉(zhuǎn)到應(yīng)用詳情

  1. android 跳轉(zhuǎn)

    setData : 傳入的是uri,用于數(shù)據(jù)的過濾。setData可以被系統(tǒng)用來尋找匹配目標(biāo)組件。
    putExtra: 只是用來設(shè)定各種不同類型的附加數(shù)據(jù)。不被系統(tǒng)用來尋找匹配目標(biāo)組件。
    直接跳轉(zhuǎn)應(yīng)用詳情里的權(quán)限頁需要適配不同品牌的手機(jī) (用雷電模擬器試了華為的發(fā)現(xiàn)沒用)

    • 安卓
          Intent intent = new Intent();
          intent.setAction(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
          intent.setData(Uri.parse("package:" + this.getPackageName()));
          startActivity(intent);
      
    • uniapp
          // 跳轉(zhuǎn)到應(yīng)用詳情
          const main = plus.android.runtimeMainActivity();
          const Intent = plus.android.newObject("android.content.Intent");
          // const Settings = plus.android.importClass("android.provider.Settings");
          const pkName = main.getPackageName();                
          const uri = plus.android.invoke("android.net.Uri", 'fromParts', 'package', pkName, null);
          // plus.android.invoke(Intent, 'setAction', Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
          // 直接用 android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTING 不行 我也不知道為啥
          plus.android.invoke(Intent, 'setAction', 'android.settings.APPLICATION_DETAILS_SETTINGS');
          plus.android.invoke(Intent, 'setData', uri);
          plus.android.invoke(main, 'startActivity', Intent);
      
      
          // 跳轉(zhuǎn)到應(yīng)用詳情對應(yīng)權(quán)限設(shè)置
          // 華為 (不生效)
          const main = plus.android.runtimeMainActivity();
          const Intent = plus.android.importClass('android.content.Intent');
          let _intent = new Intent();
          _intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          const pkName = main.getPackageName();
          _intent.putExtra("packageName", pkName);
          const ComponentName = plus.android.importClass('android.content.ComponentName');
          const _comp = new ComponentName("com.huawei.systemmanager", "com.huawei.permissionmanager.ui.MainActivity");
          _intent.setComponent(_comp);
          main.startActivity(_intent);
      
  2. IOS 跳轉(zhuǎn)

        // 跳轉(zhuǎn)應(yīng)用詳情
        const app = plus.ios.invoke('UIApplication', 'sharedApplication');
        const setting = plus.ios.invoke('NSURL', 'URLWithString:', 'app-settings:');  
        plus.ios.invoke(app, 'openURL:', setting);  
        plus.ios.deleteObject(setting);  
        plus.ios.deleteObject(app); 
    

跳轉(zhuǎn)到系統(tǒng)設(shè)置

  1. android 跳轉(zhuǎn)系統(tǒng)設(shè)置頁面

        const main = plus.android.runtimeMainActivity(),
        Settings = plus.android.importClass("android.provider.Settings");
        const Intent = plus.android.newObject('android.content.Intent', Settings.ACTION_SETTINGS);
        main.startActivity(Intent);
    
  2. android 跳轉(zhuǎn)具體服務(wù)設(shè)置頁面

        // 跳轉(zhuǎn)到 打開系統(tǒng)定位服務(wù)頁面
        const main = plus.android.runtimeMainActivity(),
        Intent = plus.android.importClass('android.content.Intent');
        const Settings = plus.android.importClass('android.provider.Settings');
        // let _intent = new Intent('android.settings.LOCATION_SOURCE_SETTINGS'); // 也可不需要Settings  直接這么寫
        let _intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
        main.startActivity(_intent); // 打開系統(tǒng)設(shè)置GPS服務(wù)頁面
    
  3. IOS 跳轉(zhuǎn)系統(tǒng)設(shè)置頁面

    看跳轉(zhuǎn)應(yīng)用

// 權(quán)限js
// #ifdef APP

// 判斷推送權(quán)限是否開啟
function judgeIosPermissionPush() {
	var result = false;
	var UIApplication = plus.ios.import("UIApplication");
	var app = UIApplication.sharedApplication();
	var enabledTypes = 0;
	if (app.currentUserNotificationSettings) {
		var settings = app.currentUserNotificationSettings();
		enabledTypes = settings.plusGetAttribute("types");
		if (enabledTypes == 0) {
		} else {
			result = true;
		}
		plus.ios.deleteObject(settings);
	} else {
		enabledTypes = app.enabledRemoteNotificationTypes();
		if (enabledTypes == 0) {
		} else {
			result = true;
		}
	}
	plus.ios.deleteObject(app);
	plus.ios.deleteObject(UIApplication);
	return result;
}

// 判斷定位權(quán)限是否開啟
function judgeIosPermissionLocation() {
	var result = false;
	var cllocationManger = plus.ios.import("CLLocationManager");
	var status = cllocationManger.authorizationStatus();
	if (status == 0 || status == 3) {
		result = true;
	} else {
		if (status == 2) {
			// gotoAppSetting('我們需要訪問您的位置,方便更加迅速的給您解決問題')
		}
	}
	plus.ios.deleteObject(cllocationManger);
	return result;
}

// 判斷麥克風(fēng)權(quán)限是否開啟
function judgeIosPermissionRecord() {
	var result = false;
	var avaudiosession = plus.ios.import("AVAudioSession");
	var avaudio = avaudiosession.sharedInstance();
	var permissionStatus = avaudio.recordPermission();
	if (permissionStatus == 1684369017 || permissionStatus == 1970168948) {
	} else {
		result = true;
	}
	plus.ios.deleteObject(avaudiosession);
	return result;
}

// 判斷相機(jī)權(quán)限是否開啟
function judgeIosPermissionCamera() {
	var result = false;
	var AVCaptureDevice = plus.ios.import("AVCaptureDevice");
	var authStatus = AVCaptureDevice.authorizationStatusForMediaType('vide');
	if (authStatus == 0 || authStatus == 3) {
		result = true
	} else {
		if (authStatus == 2) {
			// gotoAppSetting('請先允許使用相機(jī)權(quán)限')
		}
	}
	plus.ios.deleteObject(AVCaptureDevice);
	return result;
}

// 判斷相冊權(quán)限是否開啟
function judgeIosPermissionPhotoLibrary() {
	var result = false;
	var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary");
	var authStatus = PHPhotoLibrary.authorizationStatus();
	if (authStatus == 0 || authStatus == 3) {
		result = true;
	} else {
		if (authStatus == 2) {
			// gotoAppSetting('請先允許訪問相冊權(quán)限')
		}
	}
	plus.ios.deleteObject(PHPhotoLibrary);
	return result;
}

// 判斷通訊錄權(quán)限是否開啟
function judgeIosPermissionContact() {
	var result = false;
	var CNContactStore = plus.ios.import("CNContactStore");
	var cnAuthStatus = CNContactStore.authorizationStatusForEntityType(0);
	if (cnAuthStatus == 0 || cnAuthStatus == 3) {
		result = true;
	} else {
	}
	plus.ios.deleteObject(CNContactStore);
	return result;
}

// 判斷日歷權(quán)限是否開啟
function judgeIosPermissionCalendar() {
	var result = false;
	var EKEventStore = plus.ios.import("EKEventStore");
	var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(0);
	if (ekAuthStatus == 0 || ekAuthStatus == 3) {
		result = true;
	} else {
	}
	plus.ios.deleteObject(EKEventStore);
	return result;
}

// 判斷備忘錄權(quán)限是否開啟
function judgeIosPermissionMemo() {
	var result = false;
	var EKEventStore = plus.ios.import("EKEventStore");
	var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(1);
	if (ekAuthStatus == 0 || ekAuthStatus == 3) {
		result = true;
	} else {
	}
	plus.ios.deleteObject(EKEventStore);
	return result;
}

class Permission {
    #_permissonList: {
        'contact': { // 通訊錄
           'android': 'android.permission.WRITE_CONTACTS',
           'ios': 'CNContactStore'
        },
        'calendar': { // 日歷-寫
            'android': 'android.permission.WRITE_CALENDAR',
            'ios': 'CNContactStore'
        },
        'location': { // 定位
            'android': 'android.permission.ACCESS_FINE_LOCATION',
            'ios': 'CLLocationManager'
        },
        'sms': { // 發(fā)-信息
            'android': 'android.permission.SEND_SMS',
            'ios': ''
        },
        'storage': { // 外部存儲和相冊-寫
            'android': 'android.permission.WRITE_EXTERNAL_STORAGE',
            'ios': 'PHPhotoLibrary'
        },
        'camera': { // 攝像頭
            'android': 'android.permission.CAMERA',
            'ios': 'AVCaptureDevice'
        },
        'record': { // 麥克風(fēng)
            'android': 'android.permission.RECORD_AUDIO',
            'ios': 'AVAudioSession'
        },
    },
    #_androidAppActionList: { // 跳轉(zhuǎn)應(yīng)用的
        'push': 'android.settings.APP_NOTIFICATION_SETTINGS', // app的通知權(quán)限開關(guān)頁面
        
    },
    #_systemActionList: { // 跳轉(zhuǎn)系統(tǒng)設(shè)置頁面
        'location': { // gps開關(guān)頁面
            'android': 'android.settings.LOCATION_SOURCE_SETTINGS',
            'ios': ''
        }
    },
    
    constructor () {
        // 判斷手機(jī)系統(tǒng)和系統(tǒng)版本
        let os = plus.os.name; // 系統(tǒng)名稱
        this.isIos = os == 'iOS'; // 是否是ios系統(tǒng)
        if(this.isIos) {
            this.version = plus.os.version; // 版本
        } else {
            const Build = plus.android.importClass("android.os.Build");
            this.version = Build?.VERSION?.SDK_INT ?? 0;
        }
    }
    
    /**
     * @method requestAndroidPermission
     * @param {String} permissionID 安卓的權(quán)限
     * @description android 動(dòng)態(tài)申請權(quán)限
     * @return {Number | Object} -1: 拒絕權(quán)限(永久) 0: 拒絕權(quán)限(臨時(shí))1:授權(quán) || { code:'錯(cuò)誤碼', message:"錯(cuò)誤描述" }
     */
    requestAndroidPermission (permissionID) {
        return new Promise((resolve, reject)=>{
            // TODO 需要添加驗(yàn)證權(quán)限的函數(shù) 
            // FIXME ContextCompat.checkSelfPermission() 可以驗(yàn)證是否存某權(quán)限
            plus.android.requestPermissions(
                [permissionID],
                (res)=>{
                    const { granted, deniedPresent, deniedAlways } = res;
                    if(granted.length) resolve(1);       // 以獲取到權(quán)限
                    if(deniedPresent.length) resolve(0); // 已拒絕權(quán)限(臨時(shí))
                    if(deniedAlways.length) resolve(-1); // 已拒絕權(quán)限(永久)
                },
                (err)=>{
                	// message: 錯(cuò)誤信息描述 code   : 錯(cuò)誤編碼
                	resolve({...err});
                }
            )
        })
    }
    
    /**
     * @method verifyNotification
     * @return {Boolean} true: 存在權(quán)限 false: 無權(quán)限
     * @description 獲取**app**推送授權(quán)狀態(tài)
     */
    verifyNotification() {
        if (this.isIos) {
            let types = 0;
            const app = plus.ios.invoke('UIApplication', 'sharedApplication');
            const settings = plus.ios.invoke(app, 'currentUserNotificationSettings');
            if(settings) {
            	types = settings.plusGetAttribute('types');
            } else {
            	types = plus.ios.invoke(app, 'enabledRemoteNotificationTypes');  
            }
            plus.ios.deleteObject(settings);
            plus.ios.deleteObject(app);
            return types != 0;
        } else {
            const main = plus.android.runtimeMainActivity();
            let NotificationManagerCompat = plus.android.importClass("android.support.v4.app.NotificationManagerCompat");
            if (NotificationManagerCompat == null) { 
            	NotificationManagerCompat = plus.android.importClass("androidx.core.app.NotificationManagerCompat"); 
            }  
            const areNotificationsEnabled = NotificationManagerCompat.from(main).areNotificationsEnabled();
            return areNotificationsEnabled;
        }
    },
    
    
    /**
     * @method verifyPermission
     * @param {String} name 權(quán)限名稱
     * @description 驗(yàn)證是否存在授權(quán)
     * @return {boolean} false: 拒絕 true:授權(quán)
     */
    verifyPermission (name='') {
        if(this.isIos) {
            // 需要單獨(dú)處理 去調(diào)用上面方法
        } else {
            const main = plus.android.runtimeMainActivity();
            const state = main.checkSelfPermission(this.#_permissonList[name]['android']);
            return state == 1;
        }
    }
    
    /**
     * @method jumpAppDataPage
     * @description 跳轉(zhuǎn)到**應(yīng)用**的信息頁面
     */
    jumpAppInfoPage () {
        if (this.isIos) {
            const app = plus.ios.invoke('UIApplication', 'sharedApplication');
            const setting = plus.ios.invoke('NSURL', 'URLWithString:', 'app-settings:');  
            plus.ios.invoke(app, 'openURL:', setting);  
            plus.ios.deleteObject(setting);  
            plus.ios.deleteObject(app); 
        } else {
            const main = plus.android.runtimeMainActivity();
            const Intent = plus.android.newObject("android.content.Intent");
            // const Settings = plus.android.importClass("android.provider.Settings");              
            const uri = plus.android.invoke("android.net.Uri", 'fromParts', 'package', main.getPackageName(), null);
            // plus.android.invoke(Intent, 'setAction', Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
            plus.android.invoke(Intent, 'setAction', `android.settings.APPLICATION_DETAILS_SETTINGS`);
            plus.android.invoke(Intent, 'setData', uri);
            plus.android.invoke(main, 'startActivity', Intent);
        }
    }
    
    /**
     * @method JumpAppPermissionPage
     * @description 跳轉(zhuǎn)到**應(yīng)用**的授權(quán)開關(guān)頁面 (ps: 這里也可以用來到設(shè)置頁面啥的畢竟核心代碼一樣,但是懶得改了 )
     */
    JumpAppPermissionPage (action='push') {
        if(this.isIos) {
            this.jumpAppInfoPage();
        } else {
            const main = plus.android.runtimeMainActivity();
            const pkName = main.getPackageName();
            const uid = main.getApplicationInfo().plusGetAttribute("uid");
            const Intent = plus.android.newObject('android.content.Intent', this.#_androidActionList[action]); 
            
            if(this.version >= 26) { // 8.0
                Intent.putExtra('android.provider.extra.APP_PACKAGE', pkName);
                Intent.putExtra('android.provider.extra.CHANNEL_ID', uid);
                main.startActivity(Intent);
            } else if(this.version >= 21) { // 5.0-7.1
                Intent.putExtra("app_package", pkName);
                Intent.putExtra("app_uid", uid);  
                main.startActivity(Intent);
            } else {
                this.jumpAppInfoPage();
            }
        }
    },
    
    /**
     * @method verifySystemLocationServe
     * @description 驗(yàn)證**系統(tǒng)**定位服務(wù)是否開啟
     */
    verifySystemLocationServe () {
        if (this.isIos)  {
            // TODO 需要更具不同服務(wù)進(jìn)行封裝
            
            // 驗(yàn)證定位服務(wù)是否開啟的
            var result = false;
            var cllocationManger = plus.ios.import("CLLocationManager");
            var result = cllocationManger.locationServicesEnabled();
            plus.ios.deleteObject(cllocationManger);
            return result;
        } else {
            const main = plus.android.runtimeMainActivity(),
                  context = plus.android.importClass("android.content.Context"),
                  locationManager = plus.android.importClass("android.location.LocationManager");
            const mainSvr = main.getSystemService(context.LOCATION_SERVICE);
            return mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)
        }
    },
    
    /**
     * @method jumpSystemAppointPage
     * @description 跳轉(zhuǎn)到指定的**系統(tǒng)**設(shè)置頁面 (使用之前先確定 頁面是可以直接跳轉(zhuǎn)的)
     */
    jumpSystemAppointPage (action="location") {
        if (this.isIos) { 
            
        } else {
            const main = plus.android.runtimeMainActivity();
            const Intent = plus.android.newObject('android.content.Intent', this.#_systemActionList[action]['android']);
            main.startActivity(Intent); // 打開系統(tǒng)設(shè)置GPS服務(wù)頁面
        }
    }
    
    /**
     * @method jumpSystemPage
     * @description 跳轉(zhuǎn)到系統(tǒng)設(shè)置頁面
     */
    jumpSystemPage () {
        if (this.isIos) {
            this.jumpAppInfoPage();
        } else {
            const main = plus.android.runtimeMainActivity();
            // const Settings = plus.android.importClass("android.provider.Settings");
            // const Intent = plus.android.newObject('android.content.Intent', Settings.ACTION_SETTINGS);
            const Intent = plus.android.newObject('android.content.Intent',`android.settings.SETTINGS`);
            main.startActivity(Intent);
        }
    }
}

// #endif

參考

  1. Android跳轉(zhuǎn)系統(tǒng)界面_大全集

  2. Android之APP跳轉(zhuǎn)到權(quán)限設(shè)置界面適配華為、小米、vivo等

  3. Android跳轉(zhuǎn)具體應(yīng)用權(quán)限管理,三種方式

  4. iOS調(diào)用系統(tǒng)功能與跳轉(zhuǎn)到系統(tǒng)設(shè)置

  5. iOS 從應(yīng)用中跳轉(zhuǎn)至系統(tǒng)設(shè)置頁面里的多種設(shè)置頁面

  6. UIApplication方法和OpenUrl的基本用法

  7. 5+ App開發(fā)Native.js入門指南

  8. IOS10 打開系統(tǒng)設(shè)置

  9. iOS開發(fā)中的各種權(quán)限獲取和檢查

  10. android如何從應(yīng)用程序進(jìn)入設(shè)置的各個(gè)頁面

  11. Android系統(tǒng)設(shè)置— android.provider.Settings

  12. Android中action啟動(dòng)方法大全

  13. Native.js示例匯總文章來源地址http://www.zghlxwxcb.cn/news/detail-640516.html

到了這里,關(guān)于uniapp_05_權(quán)限檢測和跳轉(zhuǎn)到設(shè)置的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • uniapp 小程序 跳轉(zhuǎn)到外部鏈接

    場景 :點(diǎn)擊“積分列表”中的“積分兌換”,需要跳轉(zhuǎn)到三方的“積分商城”鏈接進(jìn)行兌換,兌換完成后,跳回小程序“積分列表”。 結(jié)論 :無法離開小程序,跳轉(zhuǎn)到其他地址。只能通過web-view內(nèi)嵌的形式,將三方鏈接內(nèi)嵌進(jìn)小程序。 參數(shù)傳遞方式 :拼接到src上 ,web-vie

    2024年02月11日
    瀏覽(20)
  • uniapp小程序跳轉(zhuǎn)到外部頁面

    方案1 使用uni-app的擴(kuò)展組件 uni-link ,使用參考文檔uni-app官網(wǎng) 該組件的行為是在app內(nèi)打開外部瀏覽器,在h5打開新網(wǎng)頁。 方案2: 通過先跳轉(zhuǎn)到web-view頁面,通過web-view這個(gè)標(biāo)簽進(jìn)行動(dòng)態(tài)綁定接收來的有效可訪問網(wǎng)址,即可實(shí)現(xiàn)跳轉(zhuǎn)功能 在pages中新建一個(gè)webview頁面 如下。 然后

    2024年02月11日
    瀏覽(21)
  • uniapp中點(diǎn)擊跳轉(zhuǎn)到tabBar的頁面

    uniapp中點(diǎn)擊跳轉(zhuǎn)到tabBar的頁面

    今天在工作中用到需要從pages頁面點(diǎn)擊按鈕跳轉(zhuǎn)到底部欄的tabBar頁面中的情況 最初代碼是這樣寫的,路徑正確,微信開發(fā)者工具也沒有報(bào)錯(cuò),但就是頁面不跳轉(zhuǎn) ?后來經(jīng)過閱讀uniapp的官方文檔,找到了從普通頁面點(diǎn)擊跳轉(zhuǎn)至tabBar頁面的方法:switchTab 話不多說,直接上代碼,調(diào)

    2024年02月13日
    瀏覽(90)
  • uniapp微信小程序跳轉(zhuǎn)到另外一個(gè)小程序

    uniapp微信小程序跳轉(zhuǎn)到另外一個(gè)小程序

    uni.navigateToMiniProgram 功能:打開另一個(gè)小程序。 App平臺打開微信小程序,使用plus.share的launchMiniProgram。注意uni-app不需要plus ready,將plus ready里的代碼寫到頁面的onLoad生命周期即可。使用此功能需在manifest中配置微信分享SDK信息,打包后生效。 各小程序平臺對跳轉(zhuǎn)到其他小程序

    2024年02月12日
    瀏覽(17)
  • uniapp實(shí)現(xiàn)點(diǎn)擊A頁面按鈕,跳轉(zhuǎn)到B頁面的指定位置

    uniapp實(shí)現(xiàn)點(diǎn)擊A頁面按鈕,跳轉(zhuǎn)到B頁面的指定位置 第一種方式: 必須必須要注意! scroll-into-view 即使是測試也不可寫死(組件布局完成后,動(dòng)態(tài)的改變這個(gè)scroll-into-view的值,才會跳到索引位置) scroll-y=“true” 固定高度 A頁面 B.頁面 第二種方式: 在A頁面的按鈕點(diǎn)擊事件中,

    2024年01月20日
    瀏覽(444)
  • uniapp 小程序如何從主包頁面跳轉(zhuǎn)到分包頁面

    uniapp 小程序如何從主包頁面跳轉(zhuǎn)到分包頁面

    在uniapp開發(fā)小程序的時(shí)候,“分包”概念一定要提前了解下,具體我就不多說了,自己看下關(guān)網(wǎng)的相關(guān)配置。 那么,如果從主包頁面,跳轉(zhuǎn)至分包的頁面呢?如圖所示 我的頁面-詳情頁? 在我的頁面創(chuàng)建好自己的鏈接,我使用的是方法創(chuàng)建的 注: 1、一定要注意跳轉(zhuǎn)的路徑,

    2024年02月16日
    瀏覽(29)
  • uniapp微信公眾號跳轉(zhuǎn)到小程序(是點(diǎn)擊微信頁面上面的按鈕/菜單跳轉(zhuǎn))

    uniapp微信公眾號跳轉(zhuǎn)到小程序(是點(diǎn)擊微信頁面上面的按鈕/菜單跳轉(zhuǎn))

    先看效果 先貼代碼: 1、先下載依賴 2、main.js 3、使用的頁面引入(或者main引入) 4、初始化、注冊 5、html 接下來才是重點(diǎn): 要在公眾號后臺配置JS接口安全域名、網(wǎng)頁授權(quán)域名、IP白名單,而且域名需要備案,在微信開發(fā)者工具中不能通過ip調(diào)試,可以修改本地hosts代理一下

    2024年02月09日
    瀏覽(113)
  • 如何Uniapp中嵌入H5,并且在H5中跳轉(zhuǎn)到APP的指定頁面

    如何Uniapp中嵌入H5,并且在H5中跳轉(zhuǎn)到APP的指定頁面

    有一個(gè)需求是,在app中嵌入一個(gè)H5頁面,H5是一個(gè)網(wǎng)絡(luò)頁面,不在app項(xiàng)目里,APP可以打開H5頁面,實(shí)現(xiàn)單點(diǎn)登錄,并且在H5 頁面中打開APP指定的頁面 在uniapp中,有一個(gè)web-view組件,這就相當(dāng)于一個(gè)瀏覽器組件,可以用來承載網(wǎng)頁的容器,會自動(dòng)鋪滿整個(gè)頁面 web-view的詳細(xì)文檔參

    2024年02月04日
    瀏覽(97)
  • 若依:如何去掉首頁,設(shè)置登錄后跳轉(zhuǎn)到第一個(gè)路由菜單

    若依:如何去掉首頁,設(shè)置登錄后跳轉(zhuǎn)到第一個(gè)路由菜單

    若依系統(tǒng)是一個(gè)很好用的,開源的前端后臺管理系統(tǒng)。 最近公司有一個(gè)需求,需要把默認(rèn)的首頁隱藏,登錄后直接跳轉(zhuǎn)到路由菜單返回的第一個(gè)頁面。 查找了不少資料,但是都沒有實(shí)際的解決方案。 ?不過最好自己還是實(shí)現(xiàn)了這個(gè)功能。 步驟如下: 1、首先應(yīng)當(dāng)找到項(xiàng)目里

    2023年04月09日
    瀏覽(155)
  • android webview 打開騰訊文檔不跳轉(zhuǎn)到申請權(quán)限界面顯示ERR_UNKNOWN_URL_SCHEME

    webview 只識別https和http開頭的地址 webview調(diào)用setWebViewClient方法,重寫shouldOverrideUrlLoading方法,返回return super.shouldOverrideUrlLoading(view, url);就可以跳轉(zhuǎn)到申請權(quán)限界面了,要登錄QQ去申請權(quán)限的時(shí)候報(bào)錯(cuò),因?yàn)檫@里會返回一個(gè)帶intent://的地址,只能跳轉(zhuǎn)到外部。要設(shè)置 以下是具體

    2024年02月06日
    瀏覽(35)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包