仿互站小程序
This commit is contained in:
37
vant/goods-action-button/index.js
Normal file
37
vant/goods-action-button/index.js
Normal file
@@ -0,0 +1,37 @@
|
||||
var t = require("../common/component"), i = require("../mixins/link"), n = require("../mixins/button"), e = require("../mixins/open-type");
|
||||
|
||||
(0, t.VantComponent)({
|
||||
mixins: [ i.link, n.button, e.openType ],
|
||||
relation: {
|
||||
type: "ancestor",
|
||||
name: "goods-action",
|
||||
linked: function(t) {
|
||||
this.parent = t;
|
||||
}
|
||||
},
|
||||
props: {
|
||||
text: String,
|
||||
color: String,
|
||||
loading: Boolean,
|
||||
disabled: Boolean,
|
||||
type: {
|
||||
type: String,
|
||||
value: "danger"
|
||||
}
|
||||
},
|
||||
mounted: function() {
|
||||
this.updateStyle();
|
||||
},
|
||||
methods: {
|
||||
onClick: function(t) {
|
||||
this.$emit("click", t.detail), this.jumpLink();
|
||||
},
|
||||
updateStyle: function() {
|
||||
var t = this.parent.children, i = void 0 === t ? [] : t, n = i.indexOf(this);
|
||||
this.setData({
|
||||
isFirst: 0 === n,
|
||||
isLast: n === i.length - 1
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user