I am trying to create a computed value that I can use in my view by following this documentation:
Within a component, I am sending an array object like this:
const tabs = ref([
{
imageSrc: '/programs/test1.png',
....
},
In another component, I am receiving it like this:
export default defineComponent({
name: 'ProgramModal',
props: {
tabs: {
type: Array as PropType<Array<any>>,
required: true,
},
},
computed: {
img() {
return `./images/modal/${encodeURIComponent(this.tabs.imageSrc)}.png`
},
},
})
However, I am encountering two errors with the computed value. The first error states:
img implicitly has return type any because it does not have a return type annotation and is referenced directly or indirectly in one of its return expression
The second error says:
Property tabs does not exist on type { img(): any; }
Can anyone help me figure out what I am doing wrong? Thanks.