登录信息获取
This commit is contained in:
parent
871137c592
commit
3f1abfa35f
@ -2,6 +2,14 @@
|
||||
<view>
|
||||
页面内容
|
||||
</view>
|
||||
|
||||
<view class="uni-form-item uni-column">
|
||||
<button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
|
||||
<image class="avatar" :src="ctx.avatarUrl"></image>
|
||||
</button>
|
||||
<input class="uni-input" placeholder="请输入昵称"/>
|
||||
</view>
|
||||
|
||||
<view class="warp">
|
||||
<button type="warn" @click="toTestPage">{{ t("my.toTestPage") }}</button>
|
||||
<button class="button" type="primary" @click="getLocation">{{ t('my.getLocation') }}</button>
|
||||
@ -23,13 +31,20 @@ import {reactive, watchEffect} from "vue"
|
||||
import {useI18n} from "vue-i18n"
|
||||
import {onReady} from "@dcloudio/uni-app";
|
||||
const {t, locale} = useI18n()
|
||||
const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
|
||||
|
||||
const ctx = reactive({
|
||||
lang: {
|
||||
switchTo: ''
|
||||
}
|
||||
},
|
||||
avatarUrl: defaultAvatarUrl,
|
||||
})
|
||||
|
||||
function onChooseAvatar(e) {
|
||||
const { avatarUrl } = e.detail
|
||||
ctx.avatarUrl = avatarUrl
|
||||
}
|
||||
|
||||
function switchLanguage(){
|
||||
if(uni.getLocale().startsWith("en")){
|
||||
uni.setLocale("zh-Hans")
|
||||
|
Loading…
Reference in New Issue
Block a user