antfu-collective / vitesse

🏕 Opinionated Vite + Vue Starter Template

Home Page:https://vitesse.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use I18N in TS file

admin8756 opened this issue · comments

I need a config file. To store some static properties. But I18N cannot be used inside.

I created a new config.ts

const { t } = useI18n();

/* 页面底部配置 */
export const FooterFunctionList = [
  {
    icon: 'home',
    name: t('footerList.home'),
    func: () => {},
  }
]

But when used this way. The project will report an error

Uncaught SyntaxError: Must be called at the top of a setup function

I think we should provide a method to use in the TS file. This is an excellent template. Adapt the functions that a large project should have.