add AddressList component

This commit is contained in:
陈嘉涵
2017-09-21 16:26:40 +08:00
parent 309744286e
commit 522655fdd8
14 changed files with 341 additions and 6 deletions
+48
View File
@@ -0,0 +1,48 @@
<template>
<div class="van-address-list">
<van-radio-group :value="value" @input="$emit('input', $event)" class="van-address-list__group">
<van-cell-group>
<van-cell v-for="(item, index) in list" :key="item.id">
<van-radio :name="item.id" @click="$emit('change', item, index)">
<div class="van-address-list__name">{{ item.name }}{{ item.tel }}</div>
<div class="van-address-list__address">收货地址{{ item.address }}</div>
</van-radio>
<van-icon name="edit" class="van-address-list__edit" @click="$emit('edit', item, index)" />
</van-cell>
</van-cell-group>
</van-radio-group>
<van-cell icon="add" class="van-address-list__add van-hairline--top" @click="$emit('add')" :title="addButtonText" isLink />
</div>
</template>
<script>
import Icon from '../icon';
import Cell from '../cell';
import CellGroup from '../cell-group';
import Radio from '../radio';
import RadioGroup from '../radio-group';
export default {
name: 'van-address-list',
components: {
[Icon.name]: Icon,
[Cell.name]: Cell,
[Radio.name]: Radio,
[CellGroup.name]: CellGroup,
[RadioGroup.name]: RadioGroup
},
props: {
value: [String, Number],
list: {
type: Array,
default: () => []
},
addButtonText: {
type: String,
default: '新增收货地址'
}
}
};
</script>
+3
View File
@@ -1,4 +1,5 @@
import Actionsheet from './actionsheet';
import AddressList from './address-list';
import Area from './area';
import Badge from './badge';
import BadgeGroup from './badge-group';
@@ -55,6 +56,7 @@ import Waterfall from './waterfall';
const version = '0.9.6';
const components = [
Actionsheet,
AddressList,
Area,
Badge,
BadgeGroup,
@@ -121,6 +123,7 @@ export {
install,
version,
Actionsheet,
AddressList,
Area,
Badge,
BadgeGroup,
+2 -2
View File
@@ -57,10 +57,10 @@ export default {
},
contentStyle() {
return {
left: -this.offsetWidth + 'px',
transform: `translate3d(${-this.offsetWidth}px, 0, 0)`,
transitionDelay: this.delay + 's',
transitionDuration: this.duration + 's',
transitionProperty: this.diableTransition ? 'none' : 'left'
transitionProperty: this.diableTransition ? 'none' : 'all'
};
}
},
+69
View File
@@ -0,0 +1,69 @@
@import './common/var.css';
.van-address-list {
height: 100%;
.van-cell__value {
color: $text-color;
padding-right: 34px;
position: relative;
}
.van-radio__label {
margin-left: 32px;
}
.van-radio__input {
top: 50%;
left: 0;
position: absolute;
transform: translate(0, -50%);
}
.van-icon-checked {
color: $blue;
}
&__group {
height: 100%;
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
}
&__name {
font-size: 14px;
line-height: 1.5;
}
&__address {
font-size: 12px;
line-height: 1.5;
color: $gray-darker;
}
&__edit {
position: absolute;
top: 50%;
right: 4px;
font-size: 24px;
color: $gray-dark;
transform: translate(0, -50%);
}
&__add {
position: fixed;
left: 0;
bottom: 0;
z-index: 9999;
padding-left: 15px;
.van-cell__text {
font-size: 16px;
}
.van-icon-add {
color: $blue;
font-size: 20px;
}
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* 基本样式入口
* Entry of basic styles
*/
@import "./common/var.css";
+1
View File
@@ -8,6 +8,7 @@ $van-checkbox-size: 18px;
.van-icon-success {
color: #fff;
display: block;
line-height: 1;
font-size: 14px;
text-align: center;
pointer-events: none;
+2 -1
View File
@@ -1,5 +1,5 @@
/**
* style entry
* Entry of all component's style
*/
/* base */
@@ -50,6 +50,7 @@
@import './tree-select.css';
/* business components */
@import './address-list.css';
@import './coupon-list.css';
@import './goods-action.css';
@import './submit-bar.css';
-1
View File
@@ -30,7 +30,6 @@
&__content {
position: absolute;
white-space: nowrap;
transition-property: left;
transition-timing-function: linear;
}
}