使用 Vue3 设置语法时如何避免 "Component is declared but its value is never read."?
How to avoid "Component is declared but its value is never read." when I use Vue3 setup syntax?
<template>
<ConfigProvider :locale="getAntdLocale">
<AppProvider>
<RouterView />
</AppProvider>
</ConfigProvider>
</template>
<script lang="ts" setup>
import { ConfigProvider } from 'ant-design-vue';
import { AppProvider } from '/@/components/Application';
import { useTitle } from '/@/hooks/web/useTitle';
import { useLocale } from '/@/locales/useLocale';
// support Multi-language
const { getAntdLocale } = useLocale();
// Listening to page changes and dynamically changing site titles
useTitle();
</script>
Vetur 显示此警告:
'ConfigProvider' is declared but its value is never read.Vetur(6133)
'getAntdLocale' is declared but its value is never read.Vetur(6133)
模板似乎无法读取带有设置语法变量的脚本。我怎样才能避免这个警告?
Vetur 有 no support for script setup
yet - it is planned for v0.37.0(当前版本为 0.34.1)
截至目前,Volar is better choice for using script setup
and TS and is recommended 甚至是 Evan You(Vue 的创建者)。我正在使用它,它真的很棒!
更新:
并在官方 Vue 3 文档中使用 Vue 3 as the New Default, Volar is recommended
<template>
<ConfigProvider :locale="getAntdLocale">
<AppProvider>
<RouterView />
</AppProvider>
</ConfigProvider>
</template>
<script lang="ts" setup>
import { ConfigProvider } from 'ant-design-vue';
import { AppProvider } from '/@/components/Application';
import { useTitle } from '/@/hooks/web/useTitle';
import { useLocale } from '/@/locales/useLocale';
// support Multi-language
const { getAntdLocale } = useLocale();
// Listening to page changes and dynamically changing site titles
useTitle();
</script>
Vetur 显示此警告:
'ConfigProvider' is declared but its value is never read.Vetur(6133)
'getAntdLocale' is declared but its value is never read.Vetur(6133)
模板似乎无法读取带有设置语法变量的脚本。我怎样才能避免这个警告?
Vetur 有 no support for script setup
yet - it is planned for v0.37.0(当前版本为 0.34.1)
截至目前,Volar is better choice for using script setup
and TS and is recommended 甚至是 Evan You(Vue 的创建者)。我正在使用它,它真的很棒!
更新: 并在官方 Vue 3 文档中使用 Vue 3 as the New Default, Volar is recommended