uni.navigateTo 跳转传参加密

// 要跳转的页面URL
const url = 'https://example.com/page';

// 要传递的参数
const params = {
  name: 'John',
  age: 30
};

// 将参数转换为JSON字符串并进行加密
const encryptedParams = btoa(JSON.stringify(params));

// 拼接URL和加密后的参数
const fullUrl = `${url}?params=${encryptedParams}`;

// 跳转到新页面
uni.navigateTo({
  url: fullUrl
});
要解密传递的参数:

        // 获取URL中的加密参数 const encryptedParams = decodeURIComponent(options.params); // 解密参数并将其转换为JavaScript对象 const params = JSON.parse(atob(encryptedParams));

猜你喜欢

转载自blog.csdn.net/weixin_67091603/article/details/130963039