提交 9f647019 编写于 作者: A Anne_LXM

兼容处理iOS上uni.getStorage(Sync)没有返回UTSJSONObject类型问题

上级 c78741ad
...@@ -3,6 +3,9 @@ import App from './App.uvue' ...@@ -3,6 +3,9 @@ import App from './App.uvue'
import { createSSRApp } from 'vue' import { createSSRApp } from 'vue'
export function createApp() { export function createApp() {
const app = createSSRApp(App) const app = createSSRApp(App)
app.config.errorHandler = (err, vm, info) => {
console.log(err, vm, info)
}
return { return {
app app
} }
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
<button open-type="chooseAvatar" @chooseavatar="bindchooseavatar" @click="uploadAvatarImg" class="box" <button open-type="chooseAvatar" @chooseavatar="bindchooseavatar" @click="uploadAvatarImg" class="box"
:class="{'showBorder':border}" :style="{width,height,lineHeight:height}"> :class="{'showBorder':border}" :style="{width,height,lineHeight:height}">
<!-- #endif --> <!-- #endif -->
<!-- #ifndef MP-WEIXIN --> <!-- #ifndef MP-WEIXIN -->
<view @click="uploadAvatarImg" class="box" :class="{'showBorder':border}" <view @click="uploadAvatarImg" class="box" :class="{'showBorder':border}"
:style="{width,height}"> :style="{width,height}">
<!-- #endif --> <!-- #endif -->
<!-- {{avatar_file!.getString("url")}} --> <!-- {{avatar_file!.getString("url")}} -->
<cloud-image v-if="avatar_file != null" :src="avatar_file!.getString('url')" :width="width" :height="height"></cloud-image> <cloud-image v-if="avatar_file != null" :src="avatar_file!.getString('url')" :width="width" :height="height"></cloud-image>
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
count: 1, count: 1,
crop, crop,
success: (res) => { success: (res) => {
// console.log('res', res); console.log('res', res);
let tempFiles = res.tempFiles as UTSJSONObject[]; let tempFiles = res.tempFiles as UTSJSONObject[];
let tempFile = tempFiles[0]; let tempFile = tempFiles[0];
let tempFileName = tempFile['name'] as string | null let tempFileName = tempFile['name'] as string | null
...@@ -185,7 +185,7 @@ ...@@ -185,7 +185,7 @@
}) })
// #endif // #endif
let _id = this.userInfo["_id"] as string let _id = this.userInfo["_id"] as string
console.log("id",_id) // console.log("id",_id)
// if(_id != null){ // if(_id != null){
// _id = "" as string // _id = "" as string
// } // }
......
...@@ -15,12 +15,17 @@ export const state = reactive({ ...@@ -15,12 +15,17 @@ export const state = reactive({
isLogin: false isLogin: false
} as State) } as State)
function initState() { function initState() {
try { try {
let userInfo = uni.getStorageSync('uni-id-pages-x-userInfo') let userInfo = uni.getStorageSync('uni-id-pages-x-userInfo')
console.log('init userInfo',userInfo);
// #ifdef APP-IOS
userInfo = new UTSJSONObject(userInfo)
// #endif
if (userInfo instanceof UTSJSONObject) { if (userInfo instanceof UTSJSONObject) {
state.userInfo = userInfo state.userInfo = userInfo
console.log('init userInfo',userInfo); // console.log('init userInfo',userInfo);
} }
} catch (e) { } catch (e) {
console.error('init userInfo error', e); console.error('init userInfo error', e);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册