见我录的视频
!
<template>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<view class="text-area">
<text class="title">{{title}}</text>
</view>
<view style="padding:40upx;text-align: center; background-color: black;color: aliceblue;margin: 100upx;width: 200upx;" @tap="upload">传图</view>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello'
}
},
onLoad() {
},
methods: {
upload(){
uni.chooseImage({
count: 3,
sizeType: ['compressed'],
sourceType: ['album'],
success: (res) => console.log('结果:', res),
fail: (err) => console.error('失败原因:', err)
});
}
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>
简单的示例代码,你们都没遇到吗?
4 个回复
金满斗 (作者) - 聚宝盆记账易,真的好用
!
金满斗 (作者) - 聚宝盆记账易,真的好用
https://uniapp.dcloud.net.cn/component/map.html 视频地址
金满斗 (作者) - 聚宝盆记账易,真的好用
找到原因了,还是要申请对应的权限才行
金满斗 (作者) - 聚宝盆记账易,真的好用
还有就是新开的虚拟机,一定要开打开图库使用了才行,不打开图库就打不开。