2018-03-26 16:04:04 +08:00
|
|
|
<template>
|
2018-08-16 11:49:38 +08:00
|
|
|
<div class="md-field" :class="{'is-plain': plain}">
|
2018-03-26 16:04:04 +08:00
|
|
|
<div
|
|
|
|
class="md-field-title"
|
2018-08-16 11:49:38 +08:00
|
|
|
v-if="title !== '' || value !== '' "
|
|
|
|
>
|
|
|
|
<div class="md-field-title-inner">
|
|
|
|
<p class="title" v-if="title !== ''">
|
|
|
|
{{title}}
|
|
|
|
</p>
|
|
|
|
<p class="value" v-if="$slots.titleValue">
|
|
|
|
<slot name="titleValue"></slot>
|
|
|
|
</p>
|
|
|
|
<p class="value" v-else-if="value !== ''">
|
|
|
|
{{value}}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-03-26 16:04:04 +08:00
|
|
|
<div class="md-field-content">
|
|
|
|
<slot></slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
export default {
|
|
|
|
name: 'md-field',
|
|
|
|
|
|
|
|
props: {
|
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
2018-08-16 11:49:38 +08:00
|
|
|
value: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
arrow: {
|
|
|
|
type: String,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
plain: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
2018-03-26 16:04:04 +08:00
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus">
|
|
|
|
.md-field
|
2018-08-16 11:49:38 +08:00
|
|
|
background-color field-bg-color
|
2018-03-26 16:04:04 +08:00
|
|
|
.md-field-title
|
2018-06-29 18:52:26 +08:00
|
|
|
padding field-padding-v field-padding-h field-title-margin field-padding-h
|
2018-08-16 11:49:38 +08:00
|
|
|
.md-field-title-inner
|
|
|
|
display flex
|
|
|
|
font-size field-title-font-size
|
|
|
|
font-weight field-title-font-weight
|
|
|
|
color field-title-color
|
|
|
|
&>p
|
|
|
|
flex 1
|
|
|
|
&.title
|
|
|
|
text-align left
|
|
|
|
&.value
|
|
|
|
font-size field-title-operator-font-size
|
|
|
|
color field-title-operator-color
|
|
|
|
text-align right
|
2018-03-26 16:04:04 +08:00
|
|
|
.md-field-content
|
|
|
|
display flex
|
|
|
|
flex-direction column
|
2018-07-01 02:02:27 +08:00
|
|
|
.md-field-item,
|
|
|
|
.md-input-item,
|
2018-08-20 15:27:26 +08:00
|
|
|
.md-input-item-brief,
|
|
|
|
.md-input-item-msg,
|
2018-07-01 02:02:27 +08:00
|
|
|
.md-radio
|
2018-06-29 18:52:26 +08:00
|
|
|
padding-left field-padding-h
|
|
|
|
padding-right field-padding-h
|
2018-03-26 16:04:04 +08:00
|
|
|
box-sizing border-box
|
2018-06-29 18:52:26 +08:00
|
|
|
.md-field-item .md-field-item-inner, .md-input-item-container
|
2018-03-26 16:04:04 +08:00
|
|
|
hairline(bottom, field-item-border-color)
|
2018-06-29 18:52:26 +08:00
|
|
|
.md-field-item:last-of-type
|
|
|
|
.md-field-item-inner::before
|
|
|
|
display none
|
2018-06-25 18:39:53 +08:00
|
|
|
// .md-input-item:last-of-type .md-input-item-container::before
|
|
|
|
// display none
|
2018-08-27 17:19:04 +08:00
|
|
|
.md-input-item.is-error .md-input-item-container
|
2018-08-20 15:27:26 +08:00
|
|
|
hairline(bottom, input-item-color-error, 0, 4px)
|
2018-08-27 17:19:04 +08:00
|
|
|
.md-input-item.is-focus .md-input-item-container
|
|
|
|
hairline(bottom, color-text-base, 0, 4px)
|
2018-08-20 15:27:26 +08:00
|
|
|
|
2018-03-26 16:04:04 +08:00
|
|
|
.md-radio .md-radio-item
|
|
|
|
padding-left 0 !important
|
|
|
|
padding-right 0 !important
|
|
|
|
|
2018-08-16 11:49:38 +08:00
|
|
|
&.is-plain
|
|
|
|
background-color field-bg-plain-color
|
|
|
|
.md-field-title
|
|
|
|
padding field-item-padding-plain-v field-padding-plain-h 0
|
|
|
|
.md-field-title-inner
|
|
|
|
padding-bottom field-item-padding-plain-v
|
|
|
|
font-size field-title-plain-font-size
|
|
|
|
color field-title-plain-color
|
|
|
|
hairline(bottom, field-item-border-color)
|
|
|
|
.md-field-item
|
|
|
|
padding-left field-padding-plain-h
|
|
|
|
padding-right field-padding-plain-h
|
|
|
|
.md-field-item-inner
|
|
|
|
margin-bottom field-item-padding-plain-v
|
|
|
|
padding 0
|
|
|
|
&:before
|
|
|
|
display none
|
|
|
|
.md-field-item-label
|
|
|
|
.md-field-item-title
|
|
|
|
font-size field-item-label-plain-font-size
|
|
|
|
color field-item-label-plain-color
|
|
|
|
.md-field-item-brief
|
|
|
|
display none
|
|
|
|
.md-field-item-content
|
2018-08-22 19:56:43 +08:00
|
|
|
font-size field-item-content-plain-font-size
|
2018-08-16 11:49:38 +08:00
|
|
|
font-weight font-weight-normal
|
|
|
|
color field-item-content-plain-color
|
|
|
|
&:first-of-type
|
|
|
|
margin-top field-item-padding-plain-v
|
2018-03-26 16:04:04 +08:00
|
|
|
</style>
|