captain-ui
Version:
有赞vue wap业务组件库
80 lines (69 loc) • 1.6 kB
JavaScript
;
exports.__esModule = true;
exports.default = void 0;
var _data = require("./data");
var _default = {
render: function render() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('demo-section', [_c('demo-block', {
attrs: {
"title": "基本用法"
}
}, [_c('cap-taglist', {
attrs: {
"tags": _vm.tags,
"goods": _vm.goods,
"coupons": _vm.coupons,
"loading-goods": _vm.loadingGoods
},
on: {
"load": _vm.onLoad,
"click": _vm.onClick,
"draw": _vm.onDraw
}
})], 1)], 1);
},
data: function data() {
return {
tags: _data.TAG,
goods: _data.GOODS,
coupons: _data.COUPONS,
loadingGoods: {}
};
},
methods: {
onLoad: function onLoad(tag) {
var _this = this;
var empty = [];
for (var i = 0; i < 10; i++) {
empty.push({});
}
this.goods[tag.alias] = empty;
setTimeout(function () {
_this.goods[tag.alias] = _data.GROUP;
tag.loading = false;
}, 300);
},
onClick: function onClick(goods, tag, index) {
var _this2 = this;
if (this.loadingGoods.alias) {
return;
}
this.loadingGoods = {
alias: tag.alias,
index: index
};
setTimeout(function () {
_this2.loadingGoods = {};
}, 1000);
},
onDraw: function onDraw(coupon) {
setTimeout(function () {
alert('领取成功');
}, 1000);
}
}
};
exports.default = _default;