[breaking change] Cell: show active color when clicked (#497)

This commit is contained in:
neverland
2017-12-29 17:09:50 +08:00
committed by GitHub
parent b8ccd48648
commit 98ece3ab8f
15 changed files with 48 additions and 27 deletions
+2 -2
View File
@@ -2,12 +2,12 @@
<div class="van-address-list">
<radio-group :value="value" @input="$emit('input', $event)" class="van-address-list__group">
<cell-group>
<cell v-for="(item, index) in list" :key="item.id">
<cell v-for="(item, index) in list" :key="item.id" is-link>
<radio :name="item.id" @click="$emit('select', item, index)">
<div class="van-address-list__name">{{ item.name }}{{ item.tel }}</div>
<div class="van-address-list__address">{{ $t('address') }}{{ item.address }}</div>
</radio>
<icon name="edit" class="van-address-list__edit" @click="$emit('edit', item, index)" />
<icon slot="right-icon" name="edit" class="van-address-list__edit" @click="$emit('edit', item, index)" />
</cell>
</cell-group>
</radio-group>
+15 -2
View File
@@ -1,5 +1,13 @@
<template>
<div class="van-cell van-hairline" :class="{ 'van-cell--required': required }" @click="onClick">
<div
class="van-cell"
:class="{
'van-hairline': border,
'van-cell--required': required,
'van-cell--clickable': isLink || clickable
}"
@click="onClick"
>
<div class="van-cell__title" v-if="$slots.title || title">
<slot name="icon">
<icon v-if="icon" :name="icon" />
@@ -43,7 +51,12 @@ export default create({
label: String,
isLink: Boolean,
required: Boolean,
value: [String, Number]
clickable: Boolean,
value: [String, Number],
border: {
type: Boolean,
default: true
}
},
methods: {
+2 -2
View File
@@ -2,12 +2,12 @@
<div class="van-contact-list">
<radio-group :value="value" @input="$emit('input', $event)">
<cell-group>
<cell v-for="(item, index) in list" :key="item.id">
<cell v-for="(item, index) in list" :key="item.id" is-link>
<radio :name="item.id" @click="$emit('select', item, index)">
<p class="van-contact-list__text">{{ $t('name') }}{{ item.name }}</p>
<p class="van-contact-list__text">{{ $t('tel') }}{{ item.tel }}</p>
</radio>
<icon name="edit" class="van-contact-list__edit" @click="$emit('edit', item, index)" />
<icon slot="right-icon" name="edit" class="van-contact-list__edit" @click="$emit('edit', item, index)" />
</cell>
</cell-group>
</radio-group>
Binary file not shown.
+1 -1
View File
@@ -47,7 +47,7 @@
&__edit {
position: absolute;
top: 50%;
right: 4px;
right: 15px;
font-size: 20px;
color: $gray-dark;
transform: translate(0, -50%);
+11 -4
View File
@@ -3,20 +3,21 @@
.van-cell {
width: 100%;
display: table;
padding: 10px 15px 10px 0;
padding: 10px 15px;
box-sizing: border-box;
line-height: 24px;
position: relative;
background-color: $white;
color: $text-color;
font-size: 14px;
overflow: hidden;
&:not(:last-child)::after {
left: 15px;
border-bottom-width: 1px;
}
&-group {
padding-left: 15px;
background-color: $white;
}
@@ -47,12 +48,18 @@
vertical-align: middle;
overflow: hidden;
&--alone {
text-align: left;
}
&--link {
padding-right: 20px;
}
}
&--alone {
text-align: left;
&--clickable {
&:active {
background-color: $active-color;
}
}
+2 -2
View File
@@ -38,8 +38,8 @@
&__edit {
position: absolute;
top: 50%;
right: 4px;
font-size: 24px;
right: 15px;
font-size: 20px;
color: $gray-dark;
transform: translate(0, -50%);
}
+1 -8
View File
@@ -1,20 +1,13 @@
@import './common/var.css';
.van-field {
width: 100%;
.van-cell__title,
.van-cell__value {
float: none;
box-sizing: border-box;
}
.van-cell__title {
width: 90px;
position: absolute;
top: 10px;
left: 0;
left: 15px;
}
.van-cell__value {
+1 -1
View File
@@ -2,5 +2,5 @@
font-style: normal;
font-weight: normal;
font-family: 'vant-icon';
src: url('./vant-icon-42d621.ttf') format('truetype');
src: url('./vant-icon-120564.ttf') format('truetype');
}
+1 -1
View File
@@ -4,7 +4,7 @@
font-style: normal;
font-weight: normal;
font-family: 'vant-icon';
src: url('https://b.yzcdn.cn/zanui/icon/vant-icon-42d621.ttf') format('truetype');
src: url('https://b.yzcdn.cn/zanui/icon/vant-icon-120564.ttf') format('truetype');
}
.van-icon {