一 点睛
1 官网
http://uniapp.dcloud.io/platform?id=%E8%B7%A8%E7%AB%AF%E5%85%BC%E5%AE%B9
二 代码
1 修改 phone.vue
<template>
<view>
<button type="primary" @click="updatePhoto">上传图片</button>
<image v-for="item in imgArr" :src="item" @click="previewImg(item)"></image>
<!-- #ifdef H5 -->
<view>在H5中可见</view>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<view>在微信小程序中可见</view>
<!-- #endif -->
</view>
</template>
<script>
export default {
data() {
return {
imgArr: []
}
},
methods: {
updatePhoto() {
uni.chooseImage({
count: 5, //默认9
success: res => {
this.imgArr = res.tempFilePaths
}