仿互站小程序
This commit is contained in:
44
vant/switch/index.js
Normal file
44
vant/switch/index.js
Normal file
@@ -0,0 +1,44 @@
|
||||
(0, require("../common/component").VantComponent)({
|
||||
field: !0,
|
||||
classes: [ "node-class" ],
|
||||
props: {
|
||||
checked: null,
|
||||
loading: Boolean,
|
||||
disabled: Boolean,
|
||||
activeColor: String,
|
||||
inactiveColor: String,
|
||||
size: {
|
||||
type: String,
|
||||
value: "30px"
|
||||
},
|
||||
activeValue: {
|
||||
type: null,
|
||||
value: !0
|
||||
},
|
||||
inactiveValue: {
|
||||
type: null,
|
||||
value: !1
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
checked: function(e) {
|
||||
this.set({
|
||||
value: e
|
||||
});
|
||||
}
|
||||
},
|
||||
created: function() {
|
||||
this.set({
|
||||
value: this.data.checked
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
onClick: function() {
|
||||
var e = this.data, t = e.activeValue, a = e.inactiveValue;
|
||||
if (!this.data.disabled && !this.data.loading) {
|
||||
var i = this.data.checked === t ? a : t;
|
||||
this.$emit("input", i), this.$emit("change", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user