mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-13 21:17:55 +08:00
fix(checkbox, toggle, radio-group): add initial value
This commit is contained in:
@@ -174,6 +174,7 @@ export class Checkbox implements ComponentInterface {
|
||||
* a higher priority.
|
||||
*/
|
||||
Promise.resolve().then(() => {
|
||||
console.log('updating hint text id');
|
||||
this.hintTextID = this.getHintTextID();
|
||||
});
|
||||
}
|
||||
@@ -193,6 +194,8 @@ export class Checkbox implements ComponentInterface {
|
||||
this.inheritedAttributes = {
|
||||
...inheritAriaAttributes(this.el),
|
||||
};
|
||||
|
||||
this.hintTextID = this.getHintTextID();
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
|
||||
const isInvalid = checkbox.classList.contains('ion-invalid');
|
||||
if (isInvalid) {
|
||||
console.log('Field marked invalid:', checkbox.label, checkbox.errorText);
|
||||
console.log('Field marked invalid:', checkbox.innerText, checkbox.errorText);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ComponentInterface, EventEmitter } from '@stencil/core';
|
||||
import { Build, Component, Element, Event, Host, Listen, Method, Prop, State, Watch, h } from '@stencil/core';
|
||||
import { checkInvalidState } from '@utils/forms';
|
||||
import { renderHiddenInput } from '@utils/helpers';
|
||||
import { inheritAriaAttributes, renderHiddenInput } from '@utils/helpers';
|
||||
|
||||
import { getIonMode } from '../../global/ionic-global';
|
||||
|
||||
@@ -171,6 +171,10 @@ export class RadioGroup implements ComponentInterface {
|
||||
this.isInvalid = checkInvalidState(this.el);
|
||||
}
|
||||
|
||||
componentWillLoad() {
|
||||
this.hintTextID = this.getHintTextID();
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
// Clean up validation observer to prevent memory leaks.
|
||||
if (this.validationObserver) {
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
|
||||
const isInvalid = radioGroup.classList.contains('ion-invalid');
|
||||
if (isInvalid) {
|
||||
console.log('Field marked invalid:', radioGroup.label, radioGroup.errorText);
|
||||
console.log('Field marked invalid:', radioGroup.id, radioGroup.errorText);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
|
||||
const isInvalid = toggle.classList.contains('ion-invalid');
|
||||
if (isInvalid) {
|
||||
console.log('Field marked invalid:', toggle.label, toggle.errorText);
|
||||
console.log('Field marked invalid:', toggle.innerText, toggle.errorText);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -269,6 +269,8 @@ export class Toggle implements ComponentInterface {
|
||||
this.inheritedAttributes = {
|
||||
...inheritAriaAttributes(this.el),
|
||||
};
|
||||
|
||||
this.hintTextID = this.getHintTextID();
|
||||
}
|
||||
|
||||
private onStart() {
|
||||
|
||||
Reference in New Issue
Block a user