add CellSwitch component

This commit is contained in:
陈嘉涵
2017-08-28 17:38:32 +08:00
parent c9031494be
commit 245f03309f
7 changed files with 209 additions and 0 deletions
+3
View File
@@ -31,6 +31,7 @@ import Steps from './steps';
import Swipe from './swipe';
import SwipeItem from './swipe-item';
import Switch from './switch';
import SwitchCell from './switch-cell';
import Tab from './tab';
import Tabs from './tabs';
import Tag from './tag';
@@ -70,6 +71,7 @@ const components = [
Swipe,
SwipeItem,
Switch,
SwitchCell,
Tab,
Tabs,
Tag,
@@ -125,6 +127,7 @@ export {
Swipe,
SwipeItem,
Switch,
SwitchCell,
Tab,
Tabs,
Tag,
+32
View File
@@ -0,0 +1,32 @@
<template>
<van-cell :title="title" class="van-switch-cell">
<van-switch :value="value" @input="$emit('input', $event)" :disabled="disabled" :loading="loading" />
</van-cell>
</template>
<script>
import Cell from '../cell';
import Switch from '../switch';
export default {
name: 'van-switch-cell',
components: {
[Cell.name]: Cell,
[Switch.name]: Switch
},
props: {
title: String,
value: Boolean,
loading: Boolean,
disabled: Boolean
},
watch: {
value() {
this.$emit('change', this.value);
}
}
};
</script>
+1
View File
@@ -31,3 +31,4 @@
@import './uploader.css';
@import './swipe.css';
@import './notice-bar.css';
@import './switch-cell.css';
+9
View File
@@ -0,0 +1,9 @@
.van-switch-cell {
.van-cell__title {
vertical-align: middle;
}
.van-switch {
float: right;
}
}