feat: add watch method for i18n and options of menu.js;

新增:为 menu.js 组件增加 i18n 和 options 选项的监听;
master
chenghongxing 5 years ago
parent 1ba8f20b76
commit ec3e4b5571
  1. 13
      src/components/menu/menu.js

@ -89,6 +89,19 @@ export default {
}
},
watch: {
options(val) {
if (!val[0].fullPath) {
this.formatOptions(this.options, '')
}
},
i18n(val) {
if(val && val.messages) {
const messages = this.i18n.messages
Object.keys(messages).forEach(key => {
this.$i18n.mergeLocaleMessage(key, messages[key])
})
}
},
collapsed (val) {
if (val) {
this.cachedOpenKeys = this.sOpenKeys

Loading…
Cancel
Save