[개발 공부]/[VueJS]
[VueJS] toRefs 사용하기
wild keyboardist
2024. 5. 13. 14:50
[VueJS] toRefs 사용하기
[toRefs: from export page to import page]
// export page
import {reactive, toRefs} from 'vue';
export const useCount = () => {
const state = reactive({
count: 0
});
return toRefs(state);
}
// import page
import {useCount} from '@/components/<file location>';
setup() {
const {count} = useCount();
return {
count,
}
}