vant/packages/badge/index.vue
neverland ffa3fddfae
[bugfix] remove unnecessary props (#323)
* fix: Tabbar icon line-height

* [new feature] progress add showPivot prop

* [new feature] TabItem support vue-router

* [new feature] update document header style

* [Doc] add toast english ducoment

* [bugfix] Search box-sizing wrong

* [Doc] update vant-demo respo

* [Doc] translate theme & demo pages

* [Doc] add Internationalization document

* [bugfix] remove unnecessary props
2017-11-16 03:12:13 -06:00

35 lines
626 B
Vue

<template>
<a :class="['van-badge van-hairline', { 'van-badge--select': isSelect }]" :href="url" @click="onClick">
<div v-if="info" class="van-badge__info">{{ info }}</div>
{{ title }}
</a>
</template>
<script>
export default {
name: 'van-badge',
props: {
url: String,
info: String,
title: String
},
beforeCreate() {
this.$parent.badges.push(this);
},
computed: {
isSelect() {
return this.$parent.badges.indexOf(this) === this.$parent.activeKey;
}
},
methods: {
onClick() {
this.$emit('click', this.$parent.badges.indexOf(this));
}
}
};
</script>