Files
MiniProgram/ProjectLiaisonForm/pages/home/clientdemand/index.js
2025-08-15 14:05:08 +08:00

38 lines
755 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Component({
data: {
autosize: {
maxHeight:260,
minHeight: 20,
},
innerValue: ''
},
properties: {
label: String,
placeholder: String,
field: String, // 字段标识(如'name'/'phone'
value: String // 父组件传入的值(可选双向绑定)
},
observers: {
// 监听父组件传入的value变化
'value': function(val) {
this.setData({ innerValue: val });
}
},
methods: {
// 输入变化时触发
handleInputChange(e) {
const value = e.detail.value;
this.setData({ innerValue: value });
// 向父组件传递数据
this.triggerEvent('change', {
field: this.properties.field,
value: value
});
}
}
});