• vue 多语言


    方式1.

    引入插件vue-i18n  

    cnpm install vue-i18n

    main.js:

    import VueI18n from "vue-i18n";
    Vue.use(VueI18n);
    const i18n = new VueI18n({
      locale: "en", // 语言标识
      //this.$i18n.locale // 通过切换locale的值来实现语言切换
      messages: {
        zh: require("./common/lang/zh"), // 中文语言包
        en: require("./common/lang/en") // 英文语言包
      }
    });
    

      

    new Vue({
      el: "#app",
      router,
      i18n,
      components: { App },
      template: "<App/>"
    });
    

      helloworld.vue:

      <span>{{$t('m.music')}}</span>
    

      

  • 相关阅读:
    自闭的D7
    D2
    Codeforces Round #531 (Div. 3)
    hello 2019 D
    牛客练习赛36B
    cf954H
    gym102007 E
    Gym 101972
    Gym 101810
    试题 历届试题 青蛙跳杯子(bfs)
  • 原文地址:https://www.cnblogs.com/gggwf/p/9151439.html
Copyright © 2020-2023  润新知