Closed BennaceurHichem closed 3 years ago
it was solved by moving the setup() method into @Component({})
, and it looks now like this :
<script lang="ts">
import { ssrRef, watch } from '@nuxtjs/composition-api';
import LitepieDatepicker from 'vue2-litepie-datepicker';
import { Vue, Component, Prop } from 'vue-property-decorator';
@Component({
setup(props) {
const myRef = ssrRef(null);
const dateValue = ssrRef([]);
const formatter = ssrRef({
date: 'DD/MM/YY',
});
watch(dateValue, (oldValue, newValue) => {
//props.context.model = newValue;
});
return {
myRef,
dateValue,
formatter,
};
},
name: 'datepicker',
components: {
LitepieDatepicker,
},
})
export default class Datepicker extends Vue {
....
I have this date picker component where I'm using class-based component using
extends Vue
, the majority of props are passed correctly and the date picker is rendered correctly, but the problem is that passing the formatted is not possible because I'm using extends Vue instead ofexport const defineComponent
({}) where : defineComponent is imported from'@nuxtjs/composition-api'
this is the source code of the component:
the issue is that the formatter is not detected from setup() function in the template, How can I make this class-based component a component based on defineComponent({}) to pass correctly the new format of dates?