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.
IOReportMgt/IOReportSysMP/miniprogram/components/yinput/yinput.js

52 lines
1.6 KiB

"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: String,
value: String,
padding: String,
borderStyle: String,
onlyRead: Boolean,
label: {
type: String,
value: "",
},
placeholder: {
type: String,
value: "请输入",
},
},
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: {
ready: function () {
var initValue = this.data.defaultValue || '';
this.dataset[this.data.bindValue] = initValue;
this.setData({ value: initValue });
},
},
methods: {
// 这个方法是父组件提供的,这里只是为了不报错
updateFormItemValue: function (_) { },
bindinput: function (event) {
this.dataset[this.data.bindValue] = event.detail.value;
this.updateFormItemValue(event.detail.value);
}
}
});