步骤条组件新增direction和activeColor属性,增加了竖的步骤条 (#49)

This commit is contained in:
张敏
2017-07-04 19:06:04 +08:00
committed by GitHub
parent 2584fb8b04
commit 2c47a3443b
5 changed files with 213 additions and 82 deletions
+20 -2
View File
@@ -1,5 +1,5 @@
<template>
<div class="van-steps" :class="`van-steps--${steps.length}`">
<div class="van-steps" :class="stepsClass">
<div class="van-steps__status" v-if="title || description">
<div class="van-steps__icon" v-if="icon || $slots.icon">
<slot name="icon">
@@ -41,13 +41,31 @@ export default {
default: ''
},
title: String,
description: String
description: String,
direction: {
type: String,
default: 'horizontal'
},
activeColor: {
type: String,
default: '#06bf04'
}
},
data() {
return {
steps: []
};
},
computed: {
stepsClass() {
const direction = this.direction;
const lengthClass = `van-steps--${this.steps.length}`;
const directionClass = `van-steps--${direction}`;
return direction === 'horizontal' ? [lengthClass, directionClass] : [directionClass];
}
}
};
</script>