question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

7.4.2 Cannot read property '_t' of undefined

See original GitHub issue
[Vue warn]: Error in render: "TypeError: Cannot read property '_t' of undefined"

found in

---> <ISelect>
       <Test> at resources/assets/js/views/test.vue
         <Root>
TypeError: Cannot read property '_t' of undefined
    at VueComponent.<anonymous> (app.js:83551)
    at VueComponent.i18nHandler (app.js:53665)
    at VueComponent.t (app.js:53670)
    at VueComponent.t (app.js:49081)
    at VueComponent.boundFn [as t] (app.js:654)
    at VueComponent.localePlaceholder (app.js:51461)
    at Watcher.get (app.js:3577)
    at Watcher.evaluate (app.js:3684)
    at Proxy.computedGetter (app.js:3936)
    at Proxy.render (app.js:71068)

I’ve had the same problem. I have not used the ‘_t’ property .I found that someone also met the same problem. Here are some of my configurations main.js

import iView from 'iview'
import VueI18n from 'vue-i18n';
Vue.use(VueI18n);
Vue.locale = () => {};
const messages = {
    zh: Object.assign(require('./lang/zh-cn'), zh),
    en: Object.assign(require('./lang/en-us'), en),
};

const i18n = new VueI18n({
    locale: 'zh', // set locale
    messages // set locale messages
});

const app = new Vue(Vue.util.extend({ router, store, i18n }, App)).$mount('#app');

test.vue

<template>
    <div>
        <Select v-model="global">
            <Option :value="item.id" :key="item.id" v-for="item in country">{{ item.name }}</Option>
        </Select>
    </div>
</template>
<script>
    export default {
        data () {
            return {
                global:'',
                country:this.$t('country'), 
            }
        },
        methods: {
        },
        mounted() {
        },
    }
</script>

When I use iView’s DatePicker and Select tags, it will happen

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:16

github_iconTop GitHub Comments

11reactions
vedmantcommented, Aug 17, 2019

The same here, this package documentation is terrible, examples just don’t work.

10reactions
qiaochangweicommented, Mar 8, 2018

The document has been omitted.

iview.i18n((key, value) => i18n.t(key, value))

add this code ,it will be ok

The complete example should be:

Vue.locale = () => {};
    const messages = {
        en: Object.assign({ message: 'hello' }, iview.langs['en-US']),
        zh: Object.assign({ message: '你好' }, iview.langs['zh-CN'])
    };

    const i18n = new VueI18n({
      locale: 'en', // set locale
      messages, // set locale messages
    })

    iview.i18n((key, value) => i18n.t(key, value))

    new Vue({
        el: '#app',
        i18n: i18n,
        data: {
            visible: false,
            date: ''
        },
        methods: {
            show: function () {
                this.visible = true;
            }
        }
    })
Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue-i18n 'Cannot read property '_t' of undefined at Proxy.Vue.$t'
I'm using vue-cli-3 webpack config and installed vue-i18n from npm and using as a plugin. i18n.js (in src/plugins directory): import Vue from ...
Read more >
cannot read properties of undefined (reading 'install') at vue.use
Vuetify Uncaught TypeError : Cannot read property 'install' of undefined ... "In order to use treeshaking, you must import Vuetify from vuetify/lib.
Read more >
When editing a user picker custom field, a 'Cannot read ...
Exception: Uncaught TypeError: Cannot read property 'scrollTop' of undefined. Steps to reproduce. Create a customfield with User Picker (multiple users) ...
Read more >
Vue I18N Typeerror: Cannot Read Property 'T' Of Undefined
The error tells you that the Reference you are trying to use is null.References don't always have values.It's like a finger pointing to...
Read more >
Cannot read property 't' of undefined (Create Plugins) - Get Help
Cannot read property 't' of undefined (Create Plugins) ... For a long time trying to understand what the problem is. I could not....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found