mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-27 20:06:36 +08:00
50 lines
1.1 KiB
Vue
50 lines
1.1 KiB
Vue
<template>
|
|
<a :class="['zan-cell', { 'zan-cell--required': required }]" :href="url" @click="handleClick">
|
|
<div
|
|
class="zan-cell__title"
|
|
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="{
|
|
'zan-cell__value--link': isLink,
|
|
'zan-cell__value--alone': !this.$slots.title && !title && !label
|
|
}"
|
|
>
|
|
<slot>
|
|
<span v-text="value"></span>
|
|
</slot>
|
|
</div>
|
|
<i class="zan-icon zan-icon-arrow" v-if="isLink"></i>
|
|
</a>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'zan-cell',
|
|
|
|
props: {
|
|
icon: String,
|
|
title: String,
|
|
value: [String, Number],
|
|
url: String,
|
|
label: String,
|
|
isLink: Boolean,
|
|
required: Boolean
|
|
},
|
|
|
|
methods: {
|
|
handleClick() {
|
|
this.$emit('click');
|
|
}
|
|
}
|
|
};
|
|
</script>
|