dvant
Version:
A Vue.js 2.0 Mobile UI at dawnwin modified from Youzan
36 lines (27 loc) • 969 B
JavaScript
;
exports.__esModule = true;
var _utils = require('../utils');
exports.default = (0, _utils.create)({
render: function render() {
var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('a', { staticClass: "van-badge van-hairline", class: { 'van-badge--select': _vm.isSelect }, attrs: { "href": _vm.url }, on: { "click": _vm.onClick } }, [_vm.info ? _c('div', { staticClass: "van-badge__info" }, [_vm._v(_vm._s(_vm.info))]) : _vm._e(), _vm._v("\n " + _vm._s(_vm.title) + "\n")]);
},
name: 'van-badge',
props: {
url: String,
info: String,
title: String
},
beforeCreate: function beforeCreate() {
this.$parent.badges.push(this);
},
computed: {
isSelect: function isSelect() {
return this.$parent.badges.indexOf(this) === this.$parent.activeKey;
}
},
methods: {
onClick: function onClick() {
this.$emit('click', this.$parent.badges.indexOf(this));
}
}
});