DeepSelect: rename to TreeSelect

This commit is contained in:
陈嘉涵
2017-09-08 14:02:14 +08:00
parent 6ec9d9852a
commit 025133b172
8 changed files with 52 additions and 58 deletions
+6 -6
View File
@@ -13,7 +13,6 @@ import Col from './col';
import CouponCell from './coupon-cell';
import CouponList from './coupon-list';
import DatetimePicker from './datetime-picker';
import DeepSelect from './deep-select';
import Dialog from './dialog';
import Field from './field';
import GoodsAction from './goods-action';
@@ -30,12 +29,12 @@ import Picker from './picker';
import Popup from './popup';
import Progress from './progress';
import PullRefresh from './pull-refresh';
import Stepper from './stepper';
import Radio from './radio';
import RadioGroup from './radio-group';
import Row from './row';
import Search from './search';
import Step from './step';
import Stepper from './stepper';
import Steps from './steps';
import Swipe from './swipe';
import SwipeItem from './swipe-item';
@@ -45,6 +44,7 @@ import Tab from './tab';
import Tabs from './tabs';
import Tag from './tag';
import Toast from './toast';
import TreeSelect from './tree-select';
import Uploader from './uploader';
import Waterfall from './waterfall';
@@ -65,7 +65,6 @@ const components = [
CouponCell,
CouponList,
DatetimePicker,
DeepSelect,
Field,
GoodsAction,
GoodsActionBigBtn,
@@ -79,12 +78,12 @@ const components = [
Popup,
Progress,
PullRefresh,
Stepper,
Radio,
RadioGroup,
Row,
Search,
Step,
Stepper,
Steps,
Swipe,
SwipeItem,
@@ -93,6 +92,7 @@ const components = [
Tab,
Tabs,
Tag,
TreeSelect,
Uploader
];
@@ -127,7 +127,6 @@ export {
CouponCell,
CouponList,
DatetimePicker,
DeepSelect,
Dialog,
Field,
GoodsAction,
@@ -144,12 +143,12 @@ export {
Popup,
Progress,
PullRefresh,
Stepper,
Radio,
RadioGroup,
Row,
Search,
Step,
Stepper,
Steps,
Swipe,
SwipeItem,
@@ -159,6 +158,7 @@ export {
Tabs,
Tag,
Toast,
TreeSelect,
Uploader,
Waterfall
};
@@ -1,26 +1,26 @@
<template>
<div class="van-deep-select" :style="{ height: mainHeight + 'px' }">
<div class="van-deep-select__nav">
<div class="van-tree-select" :style="{ height: mainHeight + 'px' }">
<div class="van-tree-select__nav">
<div
v-for="(item, index) in items"
class="van-deep-select__nitem"
:class="{ 'van-deep-select__nitem--active': mainActiveIndex === index }"
@click="onNavClick(index)">
class="van-tree-select__nitem"
:class="{ 'van-tree-select__nitem--active': mainActiveIndex === index }"
@click="$emit('navclick', index)">
{{ item.text }}
</div>
</div>
<div class="van-deep-select__content" :style="{ height: itemHeight + 'px' }">
<div class="van-tree-select__content" :style="{ height: itemHeight + 'px' }">
<div
v-for="item in subItems"
:key="item.id"
class="van-deep-select__item"
:class="{ 'van-deep-select__item--active': activeId === item.id }"
class="van-tree-select__item"
:class="{ 'van-tree-select__item--active': activeId === item.id }"
@click="onItemSelect(item)">
{{ item.text }}
<van-icon
v-if="activeId === item.id"
name="success"
class="van-deep-select__selected"
class="van-tree-select__selected"
></van-icon>
</div>
</div>
@@ -31,7 +31,7 @@
import Icon from 'packages/icon';
export default {
name: 'van-deep-select',
name: 'van-tree-select',
components: {
'van-icon': Icon
@@ -40,9 +40,7 @@ export default {
props: {
items: {
type: Array,
default () {
return [];
}
default: () => []
},
mainActiveIndex: {
type: Number,
@@ -73,12 +71,8 @@ export default {
},
methods: {
onNavClick(index) {
this.$emit('navclick', index);
},
onItemSelect(data) {
const exportData = Object.assign({}, data);
this.$emit('itemclick', exportData);
this.$emit('itemclick', { ...data });
}
}
};
+2 -2
View File
@@ -12,7 +12,6 @@
@import './badge.css';
@import './button.css';
@import './cell.css';
@import './cell-swipe.css';
@import './card.css';
@import './icon.css';
@import './loading.css';
@@ -42,10 +41,11 @@
@import './toast.css';
/* high order components */
@import './cell-swipe.css';
@import './switch-cell.css';
@import './tree-select.css';
/* business components */
@import './deep-select.css';
@import './goods-action.css';
@import './notice-bar.css';
@import './coupon.css';
@@ -2,7 +2,7 @@
@import "./mixins/clearfix.css";
@import './common/var.css';
.van-deep-select {
.van-tree-select {
user-select: none;
position: relative;
@mixin clearfix;