Closed HDShabe closed 1 year ago
Hi @HDShabe ,
Sorry, I wasn't able to reproduce the problem.
My example:
<ui-skeleton
:loading="loading"
active
:avatar="{ size: 'large', shape: 'square' }"
>
<ui-form-field>
<ui-radio v-model="gender" input-id="male" value="M"></ui-radio>
<label for="male">Male</label>
</ui-form-field>
<ui-form-field>
<ui-radio v-model="gender" input-id="female" value="F"></ui-radio>
<label for="female">Female</label>
</ui-form-field>
</ui-skeleton>
Can you provide us with your examples?
Hi @elf-mouse
Apologies for getting back to you so late, I've had another look at this and after investigation found that the error only occurs on this page as I was newing up a viewmodel for the page in a different way to usual.
Page:
<template>
<ui-skeleton :loading="viewModel.pageLoading"
active>
<div>
Search by:
<ui-form-field>
<ui-radio v-model="viewModel.searchType" input-id="option1Radio" value="option1"></ui-radio>
<label for="option1Radio">Option 1</label>
</ui-form-field>
<ui-form-field class="radio-button">
<ui-radio v-model="viewModel.searchType" input-id="option2Radio" value="option2"></ui-radio>
<label for="option2Radio">Option 2</label>
</ui-form-field>
</div>
</ui-skeleton>
</template>
Script working:
<script lang="ts">
import { defineComponent } from 'vue';
class TestViewModel {
constructor() {
this.searchType = 'option1';
this.pageLoading = false;
}
//search criteria
searchType: String;
//loading flags
pageLoading: Boolean;
}
export default defineComponent({
data() {
return {
viewModel: TestViewModel,
}
},
mounted() {
this.viewModel = new TestViewModel();
this.viewModel.pageLoading = true;
//do some work
this.viewModel.pageLoading = false;
}
});
</script>
Script broken
export default defineComponent({
data() {
return {
viewModel: new TestViewModel(),
}
},
mounted() {
this.viewModel.pageLoading = true;
//do some work
this.viewModel.pageLoading = false;
}
});
Though in honesty, it isn't always broken...I'm happy for you to close the ticket for now and i'll keep an eye on it, unless you have any other thoughts?
This is related to the component rendering lifecycle.
Method 1:
class TestViewModel {
constructor() {
this.searchType = 'option1';
this.pageLoading = true;
}
}
Method 2:
import { nextTick } from 'vue';
class TestViewModel {
constructor() {
this.searchType = 'option1';
this.pageLoading = false;
}
}
export default {
// ...
mounted() {
nextTick(() => {
this.viewModel.pageLoading = true;
});
}
}
Thanks for your help, I'll close the ticket : ) Cheers.
Development Relevant Information:
Hi,
When I have a ui-skeleton that has some radio buttons within it, I'm getting the following console error (I use the skeleton in other places and don't get the error, and removing the radio button group to test stops the errors)
It doesn't seem to break anything on the page, just the error in the console.
Any ideas?
Cheers!