首页 > 解决方案 > 组件中的 Vue i10n

问题描述

我使用插件vue i18n。代码示例:

<template>
    <div>
        {{ test }}
    </div>
</template>

<script>
    export default {
        layout: "default",
        label: this.$t('Tools'),

        data: () => ({
            test: this.$t('Test')
        })
    }
</script>

但它不起作用。该插件尚未初始化,因此无法翻译字符串。这个问题有什么解决办法吗?

标签: vue.jslocale

解决方案


推荐阅读