<!--
|
* @Author: 小明丶
|
* @Date: 2020-05-09 13:38:38
|
* @LastEditors: zxq
|
* @LastEditTime: 2022-08-30 16:43:01
|
* @Description: cell框组件
|
-->
|
<template>
|
<div class="flex-between-g v-cell-box" @click.stop="_click">
|
<div class="left flex-start-g">
|
<svg v-if="icon" class="icon" aria-hidden="true" style="width:16px;height:16px;">
|
<use :xlink:href="'#'+icon" />
|
</svg>
|
<span style="color:red" v-show="isMust">*</span>
|
<span class="label" :class="[isTitle? 'title' : '']">{{label}}</span>
|
</div>
|
<div class="right flex-end-g">
|
<template name="v-cell-right">
|
<div class="c-text-999-g" v-if="!Show_input">
|
{{calcValue}}
|
</div>
|
<input
|
class="input"
|
:class="[readonly ? 'readonly' : '']"
|
:type="type"
|
:maxlength="max"
|
v-if="Show_input"
|
@blur.stop="_blur"
|
:disabled="readonly"
|
v-model="calcValue"
|
:placeholder="placeholder"
|
/>
|
<svg
|
v-if="isLink"
|
class="icon"
|
aria-hidden="true"
|
style="width:18px;height:18px;fill:#999;"
|
>
|
<use xlink:href="#iconright" />
|
</svg>
|
</template>
|
<slot name="button">
|
|
</slot>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
export default {
|
name: "h-cell",
|
props: {
|
max: [String, Number],
|
type: {
|
type: String,
|
default: "text"
|
},
|
// 左侧文字
|
label: String,
|
//左侧图标类名
|
icon: String,
|
isMust:{
|
type: Boolean,
|
default: false
|
},
|
//是否展示右侧图标
|
isLink: {
|
type: Boolean,
|
default: false
|
},
|
// title文字加粗
|
isTitle: {
|
type: Boolean,
|
default: false
|
},
|
// 是否只读
|
readonly: {
|
type: Boolean,
|
default: false
|
},
|
// 是否禁用
|
disabled: {
|
type: Boolean,
|
default: false
|
},
|
Show_input: {
|
type: Boolean,
|
default: true
|
},
|
// input 的vmodel
|
value: [String, Number],
|
placeholder: String
|
},
|
computed: {
|
calcValue: {
|
get() {
|
return this.value;
|
},
|
set(v) {
|
this.$emit("input", v);
|
}
|
}
|
},
|
methods:{
|
_click(){
|
this.$emit('click')
|
},
|
_blur(){
|
this.$emit('blur');
|
}
|
}
|
};
|
</script>
|
|
<style lang="less" scoped>
|
.v-cell-box {
|
padding: 16px 0;
|
background-color: @c-bg-fff;
|
margin-bottom: 1px;
|
border-bottom:1px solid #f1f1f1;
|
&:first-child {
|
border-top-left-radius: 3px;
|
border-top-right-radius: 3px;
|
|
}
|
|
&:last-child {
|
border-bottom-left-radius: 3px;
|
border-bottom-right-radius: 3px;
|
margin-bottom: 0;
|
|
}
|
|
.label {
|
font-size: @font-14;
|
font-weight:500;
|
color:rgba(101,101,101,1);
|
&.title {
|
font-weight: 500;
|
}
|
}
|
|
.left {
|
.icon {
|
margin-right: 8px;
|
}
|
}
|
|
.right{
|
width: 60%;
|
}
|
|
.input {
|
border: none;
|
outline: none;
|
width: 100%;
|
text-align: right;
|
color: @c-text-333;
|
background: @c-bg-fff;
|
&.readonly {
|
color:#999999;
|
}
|
&[disabled] {
|
opacity: 1;
|
-webkit-opacity: 1;
|
color: #999999;
|
-webkit-text-fill-color: #999999;
|
}
|
}
|
input::-webkit-input-placeholder {
|
color: #999999;
|
}
|
|
input::-moz-placeholder {
|
/* Mozilla Firefox 19+ */
|
color: #999999;
|
}
|
|
input:-moz-placeholder {
|
/* Mozilla Firefox 4 to 18 */
|
color: #999999;
|
}
|
|
input:-ms-input-placeholder {
|
/* Internet Explorer 10-11 */
|
color: #999999;
|
}
|
input:-internal-autofill-previewed,
|
input:-internal-autofill-selected {
|
-webkit-text-fill-color: #333;
|
transition: background-color 5000s ease-out 0.5s;
|
}
|
}
|
</style>
|