-
-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: added remark about component libraries #154
base: main
Are you sure you want to change the base?
Conversation
I think the message is a bit misleading. The problem is not that you can't use Instead of |
It would be nice, to have an example for exactly that: use components from Vue 3 inside a Vue 2 app. Maybe you could also add one to the example folder? I struggle with this atm. As @antfu said, I think you still need vue-demi for the different APIs. |
@antfu, you're right. I tried to rephrase it to make it more clear that it is still possible, but requires some extra steps. @dsvgl, I currently don't have any examples on how to do any of the 2 options. My use case allows me to just compile it solely for vue 2 now, and recompile for vue 3 later when we upgrade to nuxt 3. But I do agree that it might be useful to have some basic example somewhere, altough it can get complex pretty quick I think. |
@jclaessens97 ok. I have the same use case :) Do you have a repo to look into? Or maybe we could have a chat on discord, so we don't pollute this PR? I'm Dominic#2461 over there. Would be highly appreciated! Of course, only if you want. |
@antfu I really think this should add to doc asap, since SFC are the most common practice in Vue project. It should clearify that this lib might not as mighty as they think. |
https://github.com/sadeghbarati/vue-demi-component-reproductions
for example Vue 2.6 and 2.7 There are a lot of for example json-editor-vue use vue-winbox use BTW took me two weeks or maybe more to test vue-demi with Vue 2.6.14 - 2.7.10 - 3.2.39 :[ to find out what is going on |
unplugin-auto-import vue preset export const CommonCompositionAPI = [
// lifecycle
'onActivated',
'onBeforeMount',
'onBeforeUnmount',
'onBeforeUpdate',
'onErrorCaptured',
'onDeactivated',
'onMounted',
'onServerPrefetch',
'onUnmounted',
'onUpdated',
// setup helpers
'useAttrs',
'useSlots',
// reactivity,
'computed',
'customRef',
'isReadonly',
'isRef',
'markRaw',
'reactive',
'isReactive',
'isProxy',
'readonly',
'ref',
'shallowReactive',
'shallowReadonly',
'shallowRef',
'triggerRef',
'toRaw',
'toRef',
'toRefs',
'unref',
'watch',
'watchEffect',
'watchPostEffect',
'watchSyncEffect',
// component
'defineComponent',
'defineAsyncComponent',
'getCurrentInstance',
'h', // different types
'inject',
'nextTick',
'provide',
'useCssModule',
'createApp',
// effect scope
'effectScope',
'EffectScope',
'getCurrentScope',
'onScopeDispose',
] These APIs can be used within your package without needing to use If you can't handle the API with
Hope it helps someone and I Hope Anthony Correct the mistakes in my explanation |
To avoid more issues about why a certain
Vue3
library/plugin failed to work in aVue2
project, I thought it would be useful to add it to the README.md.I tried to add a more compact version of the answer @LinusBorg gave me on Discord (see #152).