"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, label: String, }, 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 () { 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); } } });