简体   繁体   中英

[Vue warn]: Error in render: "TypeError: Cannot read properties of undefined (reading '$lang')"

<Row>
  <i-col :span="8"><p class="item_key">{{ this.$lang.ui.m024 }}</p></i-col>
  <i-col :span="16">
    <Checkbox
      v-model="permissions"
      v-for="item in permissionsList"
      :value="item.value"
      :key="item.value"
      :name="item.name"
    >
      {{ this.$lang.ui.m024 }}
    </Checkbox>
  </i-col>
</Row>

for the first {{ this.$lang.ui.m024 }}, it works well in the web page, but for the {{ this.$lang.ui.m024 }} in the Checkbox, it has an error: [Vue warn]: Error in render: "TypeError: Cannot read properties of undefined (reading '$lang')"

Try to put your String into a <p> -Tag like following:

<Checkbox
  v-model="permissions"
  v-for="item in permissionsList"
  :value="item.value"
  :key="item.value"
  :name="item.name">
  <p>{{ this.$lang.ui.m024 }}</p> 
</Checkbox>

and than change this in your <style> :

.checkbox input,
.checkbox p {
  display: inline-block
}

Hopefully this works out for you - please let me know!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM