Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Compatible with properties defined by setup in Vue 2.7 class component #448

Open
richex-cn opened this issue Feb 21, 2023 · 0 comments
Open

Comments

@richex-cn
Copy link

When I try to use setup in Vue 2.7 class component, Volar cannot correctly recognize the attributes defined by setup in template:

// file: main.js
import Vue from 'vue'
import App from '@/App.vue'
import { Component } from 'vue-property-decorator'

Component.registerHooks(['setup'])

new Vue({
  name: 'App',
  render: h => h(App)
}).$mount('#app')
<!-- file: App.vue -->
<script lang="ts">
import { ref } from 'vue'
import { Vue, Component } from 'vue-property-decorator'

@Component
export default class ComponentName extends Vue {
  setup() {
    const name = ref('Admin')
    return { name }
  }
}
</script>

<template>
  <div>{{ name }}</div>
</template>

The above code is all right, But Volar prompts me Property 'name' does not exist on type 'ComponentName'. in VS Code:

Snipaste_2023-02-21_19-17-15

Can Volar consider supporting it?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant