Repository navigation
Closed
Labels
Milestone
Description
Bug Report
Ionic version:
[ ] 4.x
[x] 5.x
Current behaviour:
Whether I'm dynamically setting the color attribute on ion-input based on the ion-input's value, the field will will switch between remaining or being cleared.
Expected behaviour:
The ion-input should change the colour when the relevant dynamic colour changes without clearing the value.
Steps to reproduce:
- Create a Ionic Vue app using the
ionicCLI or
npm i @ionic/[email protected] @vue/[email protected] [email protected] -D #alongside all the necessary dependencies needed for Vue
Related code:
Template that contains:
<ion-item>
<ion-label position="floating">Email address</ion-label>
<ion-input
type="email"
autocomplete="email"
@update:modelValue="email = $event"
inputmode="email"
required
@ionBlur="checkEmail"
:color="redify('email')"
></ion-input>
</ion-item>The script section contains:
setup() {
const email = ref('email');
const validity = reactive({
email: true
});
const checkEmail = () => {
validity.email = isValidEmail(email.value); //isValidEmail is a utility function that returns `true` is the input is a valid email address or `false` if not
}
const redify = (field) => {
if (!(field in validity)) throw new Error(`"${field}" isn't a valid validity field name`);
return validity[field] ? 'dark' : 'danger'; //same error happens when '' is used instead of 'dark'
}
}insert short code snippets here
Other information:
When logging the values of the dynamic colour, it does change as expected.
Ionic info:
Ionic:
Ionic CLI : 6.11.8 (/home/maxie/.nvm/versions/node/v14.11.0/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/vue 0.3.1
Capacitor:
Capacitor CLI : 2.4.1
@capacitor/core : 2.4.1
Utility:
cordova-res : not installed
native-run : not installed
System:
NodeJS : v14.11.0 (/home/maxie/.nvm/versions/node/v14.11.0/bin/node)
npm : 6.14.8
OS : Linux 5.8
Metadata
Metadata
Assignees
Labels
Type
Fields
No fields configured for issues without a type.
Activity
liamdebeasi commentedon Sep 24, 2020
Thanks for the issue. Can you give this a try on
@ionic/[email protected]and@ionic/[email protected]? We resolved some v-model issues in 0.4.0 that I think will fix the issue you reported.If the issue still persist, please provide a GitHub repo with an application that reproduces the issue. Thanks!
Berkmann18 commentedon Sep 25, 2020
So it seems that now I can go back to using
v-model(as it previously seemed to not allow user inputs to override the value), I tried using the:color="..."on both the<ion-input />and<ion-label />and I get the following error:Which points to the following line (from the Ionic code):
Statically setting the colour works fine (i.e.
color="danger") tho.Regarding the side effect I mentioned, that has disappeared so technically this issue is resolved but I'll keep it open given the newly found error (feel free to close it tho).
liamdebeasi commentedon Sep 28, 2020
Can you provide a repo that shows this issue happening? I cannot reproduce this on my end.
Berkmann18 commentedon Sep 28, 2020
After noticing this exact error, I've been trying to pin point what was causing that and it seems that a component like:
The error happens in two views which both have the boilerplate above (with more code tho, but I didn't put what was commented out to have a concise example).
liamdebeasi commentedon Sep 28, 2020
Can you provide this as a full GitHub repo that I can clone? I still cannot reproduce the issue using the code snippet you provided.
14 remaining items
liamdebeasi commentedon Sep 30, 2020
Thanks, this looks to be an issue with the multi-tabs setup. I will look into a fix.
[-]bug: Dynamic colouring on ion-input leading to side effects (Ionic Vue)[/-][+]bug: ionic vue multi tab setup breaks navigation[/+]Livijn commentedon Oct 1, 2020
I am also getting
TypeError: Cannot read property 'classList' of undefinedwhen switching between completely blank Tabs.liamdebeasi commentedon Oct 1, 2020
@Livijn This was fixed in v0.5.2:
liamdebeasi commentedon Oct 6, 2020
@Berkmann18 Can you try this on Ionic Vue 0.5.2? I believe most of the issues you are seeing have been fixed in that version:
liamdebeasi commentedon Oct 8, 2020
Hey there,
I am going to close this issue. I updated your application to Ionic Vue 0.5.2 and can no longer reproduce the issue described in #22166 (comment). It ended up being the same issue as #22166 (comment), but I did not realize it at the time 😄 .
Please feel free to open a new issue if you run into any additional bugs. Thanks!
ionitron-bot commentedon Nov 7, 2020
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.