You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.5 KiB
45 lines
1.5 KiB
|
4 years ago
|
"use strict";
|
||
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||
|
|
};
|
||
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
|
var yfieldsControls_1 = __importDefault(require("../../yfieldsControls"));
|
||
|
|
Component({
|
||
|
|
behaviors: [yfieldsControls_1.default],
|
||
|
|
properties: {
|
||
|
|
bindValue: String,
|
||
|
|
defaultValue: Number,
|
||
|
|
label: String,
|
||
|
|
value: Number,
|
||
|
|
range: Array,
|
||
|
|
},
|
||
|
|
relations: {
|
||
|
|
'../../yform/yform': {
|
||
|
|
type: 'ancestor',
|
||
|
|
linked: function (target) {
|
||
|
|
var _this = this;
|
||
|
|
this.updateFormItemValue = function (curValue) {
|
||
|
|
target.data.form[_this.data.bindValue] = curValue;
|
||
|
|
_this.setData({ value: curValue });
|
||
|
|
};
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
lifetimes: {
|
||
|
|
attached: function () {
|
||
|
|
// 这个defaultValue是一个" "而不是undifined或者null所以不用用??
|
||
|
|
var initValue = this.data.defaultValue || '0';
|
||
|
|
this.dataset[this.data.bindValue] = initValue;
|
||
|
|
this.setData({ value: initValue });
|
||
|
|
}
|
||
|
|
},
|
||
|
|
methods: {
|
||
|
|
// 这个方法是父组件提供的,这里只是为了不报错
|
||
|
|
updateFormItemValue: function (_) { },
|
||
|
|
bindchange: function (event) {
|
||
|
|
this.dataset[this.data.bindValue] = event.detail.value;
|
||
|
|
this.updateFormItemValue(event.detail.value);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|