Commit 6566ab25 by gonglei

加入框架代码

1 parent 60cc37a5
<template>
<view>
<van-cell-group>
<van-cell title="头像" title-width="50" is-link custom-class="custom-cell" custom-style="display: flex;margin: 16px 0; align-items: center; height: 80px;">
<view style="width: 300px;float: right;text-align: right">
<uni-file-picker disable-preview :del-icon="false" fileMediatype="image" :image-styles="imageStyles" :listStyles="listStyles" @select="selectFile($event)"
:auto-upload="true"
:limit="1" file-extname="png,jpg,jpeg">
<view style="width: 300px;float: right;text-align: right">
<van-image round width="62" height="62" style="width: 300px;float: right;text-align: right;margin-right: 5px" :src="avatarUrl"/>
</view>
</uni-file-picker>
<van-cell title="头像" title-width="50" ref="filePicker" is-link custom-class="custom-cell" custom-style="display: flex;margin: 16px 0; align-items: center; height: 80px;" @click="openFilePicker">
<view style="width: 300px;display: flex;justify-content: flex-end;">
<view style="margin-right: 15px">
<uni-file-picker disable-preview :del-icon="false" fileMediatype="image" :image-styles="imageStyles" :listStyles="listStyles" @select="selectFile($event)"
:auto-upload="true" :limit="1" file-extname="png,jpg,jpeg">
<van-image round width="62" height="62" :src="avatarUrl"/>
</uni-file-picker>
</view>
</view>
</van-cell>
<!-- <van-field label="昵称" v-if="accountInfo" :value="accountInfo.nickName" placeholder="请输入昵称" :border="false" input-align="right" :maxlength="32" @change="changeNickName"/>-->
......@@ -44,12 +44,12 @@ export default class EditAccountPage extends Vue {
changeCity: any;
imageStyles = {
width: 300,
width: 70,
height: 70,
border: false,
border: {radius: '50%'},
};
listStyles = {
width: 200,
border: false,
// 是否显示分隔线
dividline: false
......@@ -115,6 +115,23 @@ export default class EditAccountPage extends Vue {
});
}
openFilePicker() {
uni.chooseFile({
count: 1, // 最多选择1个文件
type: 'image', // 可以选择所有类型
success: (res) => {
console.log('手动选择文件结果:', res);
// 模拟 uni-file-picker 的 select 事件数据结构
const eventData = {
tempFilePaths: res.tempFilePaths,
tempFiles: res.tempFiles
};
// 调用原本绑定的 onSelect 方法
this.selectFile(eventData);
}
});
}
editNickName(): void {
uni.navigateTo({
url: '/module/account/EditAccountNickName'
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!