This commit is contained in:
cookfront
2017-03-30 17:40:15 +08:00
parent 09be7c9323
commit e241d92cd9
5 changed files with 132 additions and 30 deletions
+4 -4
View File
@@ -11,8 +11,8 @@
* <zan-button size="large" type="primary">按钮</zan-button>
*/
const allowedSize = ['mini', 'small', 'normal', 'large'];
const allowedType = ['default', 'danger', 'primary'];
const ALLOWED_SIZE = ['mini', 'small', 'normal', 'large'];
const ALLOWED_TYPE = ['default', 'danger', 'primary'];
export default {
name: 'zan-button',
@@ -31,14 +31,14 @@ export default {
type: String,
default: 'default',
validator(value) {
return allowedType.indexOf(value) > -1;
return ALLOWED_TYPE.indexOf(value) > -1;
}
},
size: {
type: String,
default: 'normal',
validator(value) {
return allowedSize.indexOf(value) > -1;
return ALLOWED_SIZE.indexOf(value) > -1;
}
}
},
+13 -8
View File
@@ -1,18 +1,23 @@
<template>
<a class="zan-cell" :href="url" @click="handleClick">
<div :class="{ 'zan-cell__title': true, 'zan-cell__required': required }" v-if="this.$slots.title || title || label">
<slot name="icon">
<i v-if="icon" class="zan-icon" :class="'zan-icon-' + icon"></i>
</slot>
<div
:class="{ 'zan-cell__title': true, 'zan-cell__required': required }"
v-if="this.$slots.title || title"
>
<i v-if="icon" class="zan-icon" :class="'zan-icon-' + icon"></i>
<slot name="title">
<span class="zan-cell__text" v-text="title"></span>
<span class="zan-cell__label" v-if="label" v-text="label"></span>
</slot>
</div>
<div class="zan-cell__value" v-if="value || this.$slots.default" :class="{
'is-link': isLink,
'is-alone': !this.$slots.title && !title && !label
}">
<div
class="zan-cell__value"
v-if="value || this.$slots.default"
:class="{
'is-link': isLink,
'is-alone': !this.$slots.title && !title && !label
}"
>
<slot>
<span v-text="value"></span>
</slot>