| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <template>
- <view class="">
- <view style="position: relative;" class="uploadImg" @click="chooseImage">
- <view v-if="!model" :style="{'width':width+'rpx','height':height+'rpx'}">
- <image style="width: 60rpx;height: 60rpx;margin-bottom: 20rpx;" :src="addImg"></image>
- <text>{{title}}</text>
- </view>
- <image v-else :src="model" :style="{'width':width+'rpx','height':height+'rpx'}"></image>
- <image v-if="!model && enableImg" style="height: 160rpx;width: 90%;position: absolute" :src="bgImg">
- </image>
- </view>
- </view>
- </template>
- <script>
- export default {
- props: {
- title:String,
- //图标
- addImg: {
- type: String,
- default: 'https://guosen-bucket-ldt.obs.cn-south-1.myhuaweicloud.com:443/723e0e52706a46159203f2d243873485-t5yIWXtGE8l04314394a1700881f3d4c73f10db523dd.png'
- },
- //是否开启背景图片
- enableImg: Boolean,
- //背景图片
- bgImg: {
- type: String,
- default: 'https://guosen-bucket-ldt.obs.cn-south-1.myhuaweicloud.com:443/704abb0fbe654e95ae1f57a458dc5f92-FPFbZdIYvEv4be3706cc937d3313d3674ac283ae53fe.png'
- },
- dataName: String,
- model:String,
- width:{
- type:Number,
- default:480
- },
- height:{
- type:Number,
- default:300
- },
- },
- data() {
- return {
- };
- },
- onLoad() {
- },
- methods: {
- chooseImage() {
- this.$emit('click', this.dataName)
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .uploadImg {
- display: flex;
- align-items: center;
- justify-content: center;
- margin: 20rpx;
- view {
- z-index: 10;
- border: 4rpx dashed #e1e1e1;
- width: 480rpx;
- height: 300rpx;
- border-radius: 10rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- flex-direction: column;
- }
- .icon {
- width: 70rpx;
- height: 70rpx;
- }
-
- text {
- color: #999;
- }
- }
- </style>
|