ts文件中 使用i18n

.ts文件

import type {
    
     Composer } from 'vue-i18n';

export default function supportDetail(t: Composer['t']) {
    
    
	return {
    
    }
}

.vue文件

import {
    
     useI18n } from 'vue-i18n';

export default defineComponent({
    
    
    name: 'Test',
    components: {
    
    
        ...importComponents(
        ),
    },
    setup() {
    
    
        const {
    
     t } = useI18n();
        const supportData = reactive({
    
    
            ...supportDetail(t).filter((item) => item.type === type)[0],
        });
      
        return {
    
    supportData,};
    },
});

猜你喜欢

转载自blog.csdn.net/weixin_43814775/article/details/113960771