仿互站小程序

This commit is contained in:
Drawfans
2020-06-09 16:17:23 +08:00
commit 7bfd53851e
321 changed files with 22890 additions and 0 deletions

34
vant/badge-group/index.js Normal file
View File

@@ -0,0 +1,34 @@
(0, require("../common/component").VantComponent)({
relation: {
name: "badge",
type: "descendant",
linked: function(e) {
this.badges.push(e), this.setActive(this.data.active);
},
unlinked: function(e) {
this.badges = this.badges.filter(function(t) {
return t !== e;
}), this.setActive(this.data.active);
}
},
props: {
active: {
type: Number,
value: 0,
observer: "setActive"
}
},
beforeCreate: function() {
this.badges = [], this.currentActive = -1;
},
methods: {
setActive: function(e) {
var t = this.badges, i = this.currentActive;
if (!t.length) return Promise.resolve();
this.currentActive = e;
var s = [];
return i !== e && t[i] && s.push(t[i].setActive(!1)), t[e] && s.push(t[e].setActive(!0)),
Promise.all(s);
}
}
});

View File

@@ -0,0 +1,13 @@
{
"component": true,
"usingComponents": {
"forview": "/utils/forview/index",
"van-loading": "/vant/loading/index",
"van-dialog": "/vant/dialog/index",
"van-button": "/vant/button/index",
"van-icon": "/vant/icon/index",
"van-popup": "/vant/popup/index",
"van-tab": "/vant/tab/index",
"van-tabs": "/vant/tabs/index"
}
}

View File

@@ -0,0 +1,3 @@
<view class="van-badge-group van-hairline--top-bottom custom-class">
<slot></slot>
</view>

View File

@@ -0,0 +1,5 @@
@import "../area/index.wxss";
.van-badge-group {
width: 85px;
}