使用下面代码,直接报错:
error: No get method providing array access,
下面是自己定义的多语言对象,但是无法正常使用,{{planguage['zh']['home']}} 这样直接报错,我黔驴技穷了,求指点
<template>
<view>
<view>
{{planguage['zh']['home']}}
</view>
</view>
</template>
<script lang="uts" setup>
const currentLanguage = ref<string>('en');
const planguage = ref<UTSJSONObject>({
zh: {
home: '首页',
detail:{
intro: '介绍'
} as UTSJSONObject
} as UTSJSONObject,
en: {
home: 'home',
detail:{
intro: 'introduce'
} as UTSJSONObject,
} as UTSJSONObject,
})
</script>
0 个回复