116 lines
2.2 KiB
Vue
116 lines
2.2 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-input">
|
|
<input type="text" :placeholder="disabled?'':'请输入'" :disabled="disabled" style="text-align: right;" v-model="inputValue" @input="changeInput"/>
|
|
</view>
|
|
<text style="margin-left: 6rpx;font-size: 24rpx;">{{unit}}</text>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default{
|
|
name: 'iots-input',
|
|
props:{
|
|
// 选择值
|
|
value: {
|
|
type: [String,null],
|
|
default: ''
|
|
},
|
|
// 图标
|
|
icon: {
|
|
type: [String],
|
|
default: 'icon-gongnengdingyi'
|
|
},
|
|
name: {
|
|
type: [String],
|
|
default: ''
|
|
},
|
|
logShow:{
|
|
type: [Boolean],
|
|
default: true
|
|
},
|
|
disabled:{
|
|
type: [Boolean],
|
|
default: true
|
|
},
|
|
unit:{
|
|
type: [String],
|
|
default: ''
|
|
},
|
|
},
|
|
data(){
|
|
return {
|
|
inputValue:this.vlaue
|
|
}
|
|
},
|
|
created() {
|
|
this.inputValue = this.value;
|
|
},
|
|
watch: {
|
|
value(newValue) {
|
|
this.inputValue = newValue;
|
|
}
|
|
},
|
|
methods:{
|
|
// 输入值变化
|
|
changeInput(e) {
|
|
this.$emit('input', e.detail.value);
|
|
this.$emit('change',e.detail.value);
|
|
},
|
|
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-input{
|
|
input{
|
|
flex: 1;
|
|
height: 70rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|