Files
vant/packages/cell/src/cell.vue
T
张敏andYao 8cdbb0fdd5 修复:添加reset.css和cell加上right-icon的slot (#27)
* add reset css and remove postcss-salad

* cell add right icon slog
2017-05-09 11:45:33 +08:00

54 lines
1.2 KiB
Vue

<template>
<a :class="['van-cell', { 'van-cell--required': required }]" :href="url" @click="handleClick">
<div
class="van-cell__title"
v-if="this.$slots.title || title"
>
<slot name="icon">
<i v-if="icon" class="van-icon" :class="'van-icon-' + icon"></i>
</slot>
<slot name="title">
<span class="van-cell__text" v-text="title"></span>
<span class="van-cell__label" v-if="label" v-text="label"></span>
</slot>
</div>
<div
class="van-cell__value"
v-if="value || this.$slots.default"
:class="{
'van-cell__value--link': isLink,
'van-cell__value--alone': !this.$slots.title && !title && !label
}"
>
<slot>
<span v-text="value"></span>
</slot>
</div>
<slot name="right-icon">
<i class="van-cell__right-icon van-icon van-icon-arrow" v-if="isLink"></i>
</slot>
</a>
</template>
<script>
export default {
name: 'van-cell',
props: {
icon: String,
title: String,
value: [String, Number],
url: String,
label: String,
isLink: Boolean,
required: Boolean
},
methods: {
handleClick() {
this.$emit('click');
}
}
};
</script>