mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-17 03:59:18 +08:00
42 lines
742 B
Vue
42 lines
742 B
Vue
<template>
|
|
<a class="zan-badge" :class="classNames" :href="url" @click="handleClick">
|
|
<div class="zan-badge__active"></div>
|
|
<div v-if="info" class="zan-badge__info">{{info}}</div>
|
|
{{title}}
|
|
</a>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'zan-badge',
|
|
props: {
|
|
mark: {
|
|
type: [Number, String],
|
|
required: true
|
|
},
|
|
title: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
url: {
|
|
type: String
|
|
},
|
|
info: {
|
|
type: String
|
|
}
|
|
},
|
|
methods: {
|
|
handleClick() {
|
|
this.$parent.computedActiveKey = this.mark;
|
|
}
|
|
},
|
|
computed: {
|
|
classNames() {
|
|
return {
|
|
'is-select': this.mark === this.$parent.computedActiveKey
|
|
};
|
|
}
|
|
}
|
|
};
|
|
</script>
|