仿互站小程序
This commit is contained in:
44
vant/collapse/index.js
Normal file
44
vant/collapse/index.js
Normal file
@@ -0,0 +1,44 @@
|
||||
(0, require("../common/component").VantComponent)({
|
||||
relation: {
|
||||
name: "collapse-item",
|
||||
type: "descendant",
|
||||
linked: function(e) {
|
||||
this.children.push(e);
|
||||
},
|
||||
unlinked: function(e) {
|
||||
this.children = this.children.filter(function(n) {
|
||||
return n !== e;
|
||||
});
|
||||
}
|
||||
},
|
||||
props: {
|
||||
value: {
|
||||
type: null,
|
||||
observer: "updateExpanded"
|
||||
},
|
||||
accordion: {
|
||||
type: Boolean,
|
||||
observer: "updateExpanded"
|
||||
},
|
||||
border: {
|
||||
type: Boolean,
|
||||
value: !0
|
||||
}
|
||||
},
|
||||
beforeCreate: function() {
|
||||
this.children = [];
|
||||
},
|
||||
methods: {
|
||||
updateExpanded: function() {
|
||||
this.children.forEach(function(e) {
|
||||
e.updateExpanded();
|
||||
});
|
||||
},
|
||||
switch: function(e, n) {
|
||||
var t = this.data, i = t.accordion, o = t.value;
|
||||
e = i ? n ? e : "" : n ? (o || []).concat(e) : (o || []).filter(function(n) {
|
||||
return n !== e;
|
||||
}), this.$emit("change", e), this.$emit("input", e);
|
||||
}
|
||||
}
|
||||
});
|
13
vant/collapse/index.json
Normal file
13
vant/collapse/index.json
Normal 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"
|
||||
}
|
||||
}
|
3
vant/collapse/index.wxml
Normal file
3
vant/collapse/index.wxml
Normal file
@@ -0,0 +1,3 @@
|
||||
<view class="custom-class van-collapse {{border?'van-hairline--top-bottom':''}}">
|
||||
<slot></slot>
|
||||
</view>
|
1
vant/collapse/index.wxss
Normal file
1
vant/collapse/index.wxss
Normal file
@@ -0,0 +1 @@
|
||||
@import "../area/index.wxss";
|
Reference in New Issue
Block a user