<template>
<uni-shadow-root class="vant-badge-group-index"><view class="van-badge-group van-hairline--top-bottom custom-class">
  <slot></slot>
</view></uni-shadow-root>
</template>

<script>

global['__wxRoute'] = 'vant/badge-group/index'
"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require('./../common/component.js');
component_1.VantComponent({
    relation: {
        name: 'badge',
        type: 'descendant',
        linked: function linked(target) {
            this.badges.push(target);
            this.setActive(this.data.active);
        },
        unlinked: function unlinked(target) {
            this.badges = this.badges.filter(function (item) {
                return item !== target;
            });
            this.setActive(this.data.active);
        }
    },
    props: {
        active: {
            type: Number,
            value: 0,
            observer: 'setActive'
        }
    },
    beforeCreate: function beforeCreate() {
        this.badges = [];
        this.currentActive = -1;
    },
    methods: {
        setActive: function setActive(active) {
            var _a = this,
                badges = _a.badges,
                currentActive = _a.currentActive;
            if (!badges.length) {
                return Promise.resolve();
            }
            this.currentActive = active;
            var stack = [];
            if (currentActive !== active && badges[currentActive]) {
                stack.push(badges[currentActive].setActive(false));
            }
            if (badges[active]) {
                stack.push(badges[active].setActive(true));
            }
            return Promise.all(stack);
        }
    }
});
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbIk9iamVjdCIsInZhbHVlIiwiY29tcG9uZW50XzEiLCJyZXF1aXJlIiwicmVsYXRpb24iLCJuYW1lIiwidHlwZSIsImxpbmtlZCIsInVubGlua2VkIiwiaXRlbSIsInByb3BzIiwiYWN0aXZlIiwib2JzZXJ2ZXIiLCJiZWZvcmVDcmVhdGUiLCJtZXRob2RzIiwic2V0QWN0aXZlIiwiX2EiLCJiYWRnZXMiLCJjdXJyZW50QWN0aXZlIiwiUHJvbWlzZSIsInN0YWNrIl0sIm1hcHBpbmdzIjoiOztBQUNBQSxPQUFBQSxjQUFBQSxDQUFBQSxPQUFBQSxFQUFBQSxZQUFBQSxFQUE2QyxFQUFFQyxPQUEvQ0QsSU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nRBY3RpdmVdLnNldEFjdGl2ZShmYWxzZSkpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGJhZGdlc1thY3RpdmVdKSB7XG4gICAgICAgICAgICAgICAgc3RhY2sucHVzaChiYWRnZXNbYWN0aXZlXS5zZXRBY3RpdmUodHJ1ZSkpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIFByb21pc2UuYWxsKHN0YWNrKTtcbiAgICAgICAgfVxuICAgIH1cbn0pO1xuIl0sImZpbGUiOiJpbmRleC5qcyJ9
export default global['__wxComponents']['vant/badge-group/index']
</script>
<style platform="mp-weixin">
@import '../common/index.css';.van-badge-group{width:85px}
</style>