| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import DictionariesBehavior from "../../../../core/behavior/dictionaries.behavior";
- // module/user/components/user-data-edit/user-data-edit.ts
- Component({
- behaviors: ['wx://form-field-group', DictionariesBehavior],
- lifetimes: {
- attached() {
- console.log('渲染');
- }
- },
- properties: {
- model: { type: Object, value: {} },
- sex: { type: String, value: '' },
- retractable: { type: Boolean, value: false },
- dirty: { type: Boolean, value: false },
- },
- data: {
- expanded: false,
- showSpecialPeriodPicker: true,
- },
- observers: {
- 'model.sex, sex'(value, sex) {
- const showSpecialPeriodPicker = value === '1' || sex === '1';
- this.setData({ showSpecialPeriodPicker })
- }
- },
- methods: {
- onChange(event) {
- const name = event.mark.name;
- const value = event.detail.value;
- if (name) this.triggerEvent('change', { [name]: value }, { bubbles: true, composed: true });
- },
- onKeyboardheightchange(event) {
- const name = event.mark.name;
- if (!event.detail.height) {
- this
- .createSelectorQuery()
- .select(`#${name}`)
- .fields({ properties: ['value'] }, detail => this.onChange({ mark: { name }, detail }))
- .exec();
- }
- },
- onExpand() {
- this.setData({ expanded: true });
- }
- }
- })
|