首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >VueI18n在自定义表VueJS中传递字符串

VueI18n在自定义表VueJS中传递字符串
EN

Stack Overflow用户
提问于 2018-06-08 11:48:10
回答 1查看 724关注 0票数 0

我正在使用vue-good-table来渲染表。

代码语言:javascript
复制
 <vue-good-table
    :columns="columns"
    :rows="items"
    :paginate="true"
    :lineNumbers="true">
  </vue-good-table>

columns: [
          {
            label: 'Date',
            field: 'date',
            type: 'String',
            filterable: true,
            placeholder: 'Date'
          }
]

例如,是否可以在标签参数中使用{{ $t("column.date") }}。直到现在,它只在传递字符串时才起作用?

添加更多代码:

main.js const i18n =新VueI18n({ locale:'bg',// set locale fallbackLocale:'bg',messages // set locale messages });

代码语言:javascript
复制
Vue.prototype.$locale = {
  change (lang) {
    i18n.locale = lang
  },
  current () {
    return i18n.locale
  }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-06-08 12:16:00

代码语言:javascript
复制
columns: [
          {
            label: this.$t("column.date"),
            field: 'date',
            type: 'String',
            filterable: true,
            placeholder: 'Date'
          }
]

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50759995

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档