Skip to content
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

Vue 2 support ? #273

Closed
IndexXuan opened this issue Jun 20, 2021 · 18 comments
Closed

Vue 2 support ? #273

IndexXuan opened this issue Jun 20, 2021 · 18 comments
Labels
question Further information is requested

Comments

@IndexXuan
Copy link

IndexXuan commented Jun 20, 2021

Thanks for this great plugin/lsp.
the document said when you install @vue/runtime-dom, volar/vue-tsc support Vue 2, is it really that smooth ?

I create a Vue 2 app with @vue/composition-api by vue-cli, and the first step is v-model handler.
Vue 2 v-model means props.value + emit input & Vue 3 is modelValue + emit onUpdate:modelValue, how volar handle this different ?

repro link: https://github.com/IndexXuan/vue2-volar-test-app/blob/master/src/views/Home.vue#L9
when I have a v-input component

  props: {
    value: {
      type:  String,
      required: true,
    }
  }

when I use this v-input on parent component

<v-input v-model="xxx" />

It will ends up with error.

image
image

Also there are some template key warning(Vue 2 should place key at child), not big problem.

Thanks for you help.

@johnsoncodehk
Copy link
Member

the document said when you install @vue/runtime-dom, volar/vue-tsc support Vue 2, is it really that smooth ?

No it's not, @vue/runtime-dom only make Vue 3 type-checking working in Vue 2 project, full backward compatibility to Vue 2 is not the purpose, Vetur already do it.

On the other hand, you can use Vue 3 template compiler in Vue 2.

https://blog.ninja-squad.com/2021/06/07/what-is-new-vue-3.1/

@johnsoncodehk johnsoncodehk added the question Further information is requested label Jun 20, 2021
@IndexXuan
Copy link
Author

@johnsoncodehk I know Vue 3.1 compat build, but how ?
There are some scale-project which I cannot migrate to Vue 3.

Should I use vetur instead of volar ? But vetur not support slot type-checker. so sad.

@johnsoncodehk
Copy link
Member

Should I use vetur instead of volar?

You need to choose. If you need type support based entirely on Vue 2, please use Vetur.

@IndexXuan
Copy link
Author

I think push vetur support slot type-checker and official globalComponent typings is better.

Thanks.

@Djaler
Copy link

Djaler commented Jun 20, 2021

On the other hand, you can use Vue 3 template compiler in Vue 2.

It cannot be used in many apps, because Dependencies that rely on Vue 2 internal APIs or undocumented behavior. The most common case is usage of private properties on VNodes. If your project relies on component libraries like Vuetify, Quasar or ElementUI, it is best to wait for their Vue 3 compatible versions. https://github.com/vuejs/vue-next/tree/master/packages/vue-compat#known-limitations

Maybe you can add some workaround for this case with v-model for Vue 2?

@johnsoncodehk
Copy link
Member

@Djaler Sorry, due to maintenance costs, it will not be supported now. But technically Vue 2 template compiler can be support by Plugin API.

#185

@victorgarciaesgi

This comment has been minimized.

@johnsoncodehk

This comment has been minimized.

@victorgarciaesgi

This comment has been minimized.

@johnsoncodehk

This comment has been minimized.

@victorgarciaesgi

This comment has been minimized.

@johnsoncodehk

This comment has been minimized.

@victorgarciaesgi

This comment has been minimized.

@victorgarciaesgi

This comment has been minimized.

@johnsoncodehk

This comment has been minimized.

@johnsoncodehk
Copy link
Member

Due to the good progress recently, I consider to support vue 2 template in some way.

@johnsoncodehk johnsoncodehk reopened this Aug 7, 2021
@johnsoncodehk johnsoncodehk added enhancement New feature or request question Further information is requested and removed question Further information is requested enhancement New feature or request labels Aug 7, 2021
@johnsoncodehk
Copy link
Member

Please track #346

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants