[{"data":1,"prerenderedAt":192},["ShallowReactive",2],{"content:\u002Fposts\u002F2022\u002Fminiprogram-uniapp-issus":3,"surround:\u002Fposts\u002F2022\u002Fminiprogram-uniapp-issus":181},{"id":4,"title":5,"body":6,"canonical":159,"categories":160,"date":162,"description":159,"draft":163,"extension":164,"image":165,"meta":166,"navigation":167,"path":168,"permalink":159,"readingTime":169,"recommend":159,"references":159,"seo":174,"sitemap":175,"stem":176,"tags":177,"type":159,"updated":162,"__hash__":180},"content\u002Fposts\u002F2022\u002Fminiprogram-uniapp-issus.md","uniapp常见问题(一)",{"type":7,"value":8,"toc":145},"minimark",[9,14,18,29,32,38,41,49,53,59,65,68,78,81,88,92,111,115,126,130,136,139],[10,11,13],"h2",{"id":12},"使用-pinia-后报错","使用 pinia 后报错",[15,16,17],"p",{},"解决方式：实例化 store 时需要放置于 composable 函数内",[19,20,26],"pre",{"className":21,"code":23,"language":24,"meta":25},[22],"language-js","import { useLoginStore } from \"@\u002Fstore\u002Flogin\"\n\nconst { loginStore } = useLoginStore()\nfunction useIsLogin() {\n    function isLogin() {\n        xxx \u002F\u002F 逻辑代码\n    }\n    return { isLogin }\n}\n","js","",[27,28,23],"code",{"__ignoreMap":25},[15,30,31],{},"上面的写法打成 app 包时会导致页面白屏。更改成下面的写法就解决了",[19,33,36],{"className":34,"code":35,"language":24,"meta":25},[22],"import { useLoginStore } from \"@\u002Fstore\u002Flogin\"\n\nfunction useIsLogin() {\n    function isLogin() {\n        const { loginStore } = useLoginStore()\n        xxx \u002F\u002F 逻辑代码\n    }\n    return { isLogin }\n}\n",[27,37,35],{"__ignoreMap":25},[10,39,40],{"id":40},"使用组件默认插槽",[19,42,47],{"className":43,"code":45,"language":46,"meta":25},[44],"language-html","\u003CMyComponents>\n  \u003Ctemplate #default>content...\u003C\u002Ftemplate>\n\u003C\u002FMyComponents>\n\n\u003C!-- or -->\n\u003CMyComponents> content... \u003C\u002FMyComponents>\n","html",[27,48,45],{"__ignoreMap":25},[10,50,52],{"id":51},"打包为-app-后调用微信客服","打包为 app 后调用微信客服",[19,54,57],{"className":55,"code":56,"language":24,"meta":25},[22],"uni.share({\n    provider: \"weixin\",\n    openCustomerServiceChat: true,\n    corpid: WX_CORP_ID, \u002F\u002F 客服ID\n    customerUrl: WX_SERVICE_CHAT_URL, \u002F\u002F 客服的页面路径\n})\n",[27,58,56],{"__ignoreMap":25},[60,61,62],"blockquote",{},[15,63,64],{},"可能会遇到调用微信客服报错 (bad_param)的问题，需要在微信开放平台中创建一个移动应用。并在 hbuilderx 中配置微信分享的 appid（开放平台中移动应用的 appid）",[10,66,67],{"id":67},"打包时需注意",[69,70,71,75],"ol",{},[72,73,74],"li",{},"使用电脑模拟器进行测试时需要勾选对 x86 的支持，否则有些模拟器会打不开",[72,76,77],{},"正式打包时需要去除对 x86 CPU 的支持（勾选 x86 后云打包只能打包为 32 位的包，有些平台上传失败",[10,79,80],{"id":80},"小程序路径跳转时出现的问题",[15,82,83,84,87],{},"跳转时携带的参数中含有",[27,85,86],{"code":86},"&","字符串，会导致在跳转后的界面中使用解构获取参数时不完整。",[89,90,91],"h3",{"id":91},"解决方式",[69,93,94,100],{},[72,95,96,97,99],{},"可以在跳转前将不需要截取的参数中使用其他字符将 ",[27,98,86],{"code":86}," 符替换，在跳转后的界面中重新替换回来",[72,101,102,103,106,107,110],{},"可以使用 ",[27,104,105],{"code":105},"sotrage"," 存储数据，在跳转页面中获取 ",[27,108,109],{"code":109},"storage"," 中的值",[10,112,114],{"id":113},"小程序请求本地接口报错不在以下-request-合法域名列表中","小程序请求本地接口报错不在以下 request 合法域名列表中",[15,116,117,118,121,122,125],{},"解决方法: 在微信开发者工具中 ",[27,119,120],{"code":120},"详情 -> 本地设置"," 把 ",[27,123,124],{"code":124},"不校验本地合法域名"," 一项勾选",[10,127,129],{"id":128},"uniapp-中使用-official-account-组件时-bindload-属性和-binderror-属性不会执行","uniapp 中使用 official-account 组件时 bindload 属性和 binderror 属性不会执行",[131,132,133],"alert",{},[15,134,135],{},"将其改为 load 和 error 即可",[15,137,138],{},"uniapp 中的写法",[19,140,143],{"className":141,"code":142,"language":46,"meta":25},[44],"\u003Cofficial-account @error=\"officalAccountError\" @load=\"officalAccountErrorLoad\" \u002F>\n",[27,144,142],{"__ignoreMap":25},{"title":25,"searchDepth":146,"depth":146,"links":147},4,[148,150,151,152,153,157,158],{"id":12,"depth":149,"text":13},2,{"id":40,"depth":149,"text":40},{"id":51,"depth":149,"text":52},{"id":67,"depth":149,"text":67},{"id":80,"depth":149,"text":80,"children":154},[155],{"id":91,"depth":156,"text":91},3,{"id":113,"depth":149,"text":114},{"id":128,"depth":149,"text":129},null,[161],"代码","2022-12-04 15:25:34",false,"md","https:\u002F\u002Fbitmc.uno\u002Fpicgo\u002F679f17dc026e1-78.webp",{},true,"\u002Fposts\u002F2022\u002Fminiprogram-uniapp-issus",{"text":170,"minutes":171,"time":172,"words":173},"3 min read",2.435,146100,487,{"title":5,"description":159},{"loc":168},"posts\u002F2022\u002Fminiprogram-uniapp-issus",[178,179],"uniapp","小程序","9Dus_G6gDngN-kzi3TMlFoww5YhBv44rLfCXvORYB3w",[182,187],{"title":183,"path":184,"stem":185,"date":186,"type":159,"children":-1},"uni-app app打包上线要注意的部分","\u002Fposts\u002F2022\u002Fminiprogram-app-build","posts\u002F2022\u002Fminiprogram-app-build","2022-12-04 15:17:52",{"title":188,"path":189,"stem":190,"date":191,"type":159,"children":-1},"uniapp 条件编译","\u002Fposts\u002F2022\u002Fminiprogram-uniapp-conditional-compilation","posts\u002F2022\u002Fminiprogram-uniapp-conditional-compilation","2022-12-04 15:26:54",1789642597354]