Subscribe on changes!

setup expose, component should have typescript declaration

avatar
Oct 29th 2021
import { defineComponent, ref, Ref } from 'vue';

const Hello = defineComponent({
    props: { msg: String },
    setup: (props, { expose }) => {
        const count: Ref<number> = ref(0);
        expose({ a: 1, b: 2 });
        return () => <div>{count.value} </div>;
    },
});

declare const hello: InstanceType<typeof Hello>;

image

a and b are not exposed.

releated issue: https://github.com/vuejs/vue-next/issues/4397

avatar
Oct 29th 2021

Duplicate of https://github.com/vuejs/vue-next/issues/4397 Don't skip the issue template