修改cell样式,添加required功能

This commit is contained in:
niunai 2017-03-19 16:17:13 +08:00
parent 6ecc410b7d
commit a2cd7b62a7
4 changed files with 38 additions and 7 deletions

View File

@ -29,6 +29,18 @@ export default {
```
:::
### 带*号,标明必填
传入`required`属性
:::demo 带*号,标明必填
```html
<zan-cell-group>
<zan-cell title="单元格1" required></zan-cell>
</zan-cell-group>
```
:::
### 标题带描述信息
传入`label`属性,属性值为描述信息的值。

View File

@ -1,6 +1,6 @@
<template>
<a class="zan-cell" :href="url" @click="handleClick">
<div class="zan-cell__title">
<div :class="{ 'zan-cell__title': true, 'zan-cell__required': required }">
<slot name="icon">
<i v-if="icon" class="zan-icon" :class="'zan-icon-' + icon"></i>
</slot>
@ -31,7 +31,8 @@ export default {
value: [String, Number],
url: String,
label: String,
isLink: Boolean
isLink: Boolean,
required: Boolean
},
methods: {

View File

@ -3,7 +3,7 @@
@component-namespace zan {
@b cell-group {
padding-left: 10px;
padding-left: 15px;
position: relative;
background-color: #fff;
@ -14,9 +14,8 @@
@b cell {
display: block;
overflow: hidden;
position: relative;
padding: 10px 10px 10px 0;
padding: 10px 15px 10px 0;
box-sizing: border-box;
line-height: 22px;
background-color: $c-white;
@ -35,8 +34,20 @@
}
@e title {
float: left;
display: inline-block;
overflow: hidden;
/* 清除空白字符对高度的影响 */
vertical-align: bottom;
&.zan-cell__required {
&::before {
content: '*';
position: absolute;
left: -7px;
font-size: 14px;
color: #f44;
}
}
}
@e label {
@ -62,7 +73,7 @@
.zan-icon-arrow {
position: absolute;
top: 50%;
right: 10px;
right: 15px;
transform: translateY(-50%);
color: $c-gray-dark;
font-size: 12px;

View File

@ -0,0 +1,7 @@
@define-mixin clearfix {
&::after {
content: '';
display: table;
clear: both;
}
}