如何解决如何在VSCode中为全局注册的Vue组件启用自动补全功能?
VSCode的自动完成功能与Vue组件的本地注册完美配合,如下所示:
<template>
<base-button />
</template>
<script lang="ts">
import { Component,Vue } from 'vue-property-decorator';
import BaseButton from '@/components/base/BaseButton.vue';
@Component({
components: { BaseButton }
})
export default class MyComponent extends Vue {}
</script>
然后,例如,用我的base-button
拥有道具extraClass
,id
和type
,VSCode会正确地向我显示所有道具:
但是当我在base
中全局注册我的main.ts
组件时,就像这样:
import Vue from 'vue';
import App from './App.vue';
import BaseButton from '@/components/base/BaseButton.vue';
Vue.component('BaseButton',BaseButton);
Vue.config.productionTip = false;
new Vue({
render: h => h(App)
}).$mount('#app');
Vue仍能按预期工作,但是VSCode现在不会显示这些组件的任何自动完成功能。
我该如何更改? 在全局注册时,如何启用VSCode来显示自写组件的道具的自动完成功能?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。