iot-ui-app/components/iot-components/img/iots-img.vue

116 lines
2.0 KiB
Vue

<template>
<view class="iots-component-box">
<view class="attr-item-left">
<view class="iconfont" :class="icon"></view>
<view class="attr-name">{{name}}</view>
<view v-if="logShow" class="iconfont icon-unordered-list" @click="clickLog"></view>
</view>
<view class="attr-item-right">
<view class="attr-value item-border">
<view class="item-img-box">
<image :src="value" @click="lookImg"></image>
</view>
</view>
</view>
</view>
</template>
<script>
export default{
name: 'iots-switch',
props:{
// 选择值
value: {
type: [String],
default: ''
},
// 图标处理后
icon: {
type: [String],
default: 'icon-tupian'
},
name: {
type: [String],
default: ''
},
logShow:{
type: [Boolean],
default: true
},
disabled:{
type: [Boolean],
default: true
},
},
data() {
return {
};
},
methods:{
lookImg(){
if(this.value!==''){
uni.previewImage({
urls: [this.value],
});
}
},
// 点击步进器
changeSwitch(e) {
console.log("e",e)
this.$emit('input', e);
this.$emit('change',e);
},
clickLog(){
this.$emit('clickLog');
}
}
}
</script>
<style lang="scss" scoped>
@import '../common.css';
.iots-component-box{
padding: 20rpx 20rpx;
background: #fff;
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 20rpx;
border-radius: 10rpx;
// .attr-item-left{
// display: flex;
// align-items: center;
// font-size: 28rpx;
// color: #000;
// .iconfont{
// margin-right: 20rpx;
// font-size: 40rpx;
// }
// }
.attr-item-right{
flex: 1;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
.attr-value{
display: flex;
align-items: center;
justify-content: flex-end;
height: 70rpx;
flex: 1;
.item-img-box{
width: 100rpx;
height:100rpx;
background: #f5f5f5;
image{
width: 100%;
height: 100%;
}
}
}
}
}
</style>