captain-ui
Version:
有赞vue wap业务组件库
73 lines (65 loc) • 1.5 kB
JavaScript
import { GOODS, TAG, GROUP, COUPONS } from './data';
export 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: TAG,
goods: GOODS,
coupons: 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] = 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);
}
}
};