From d06835e27924bb9ef8e2f34038813dfd76b06656 Mon Sep 17 00:00:00 2001 From: "kaeyon.zdinnovis" <65881194+kaeyon@users.noreply.github.com> Date: Thu, 29 Oct 2020 11:40:10 +0800 Subject: [PATCH] Update plugins.md according to the usage of the plugin and avoid undefined errors when experimenting with the sample code, `i18n` as the initialValue of reduce() should be `options` --- src/guide/plugins.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/guide/plugins.md b/src/guide/plugins.md index e636e36b92..48481a9587 100644 --- a/src/guide/plugins.md +++ b/src/guide/plugins.md @@ -42,7 +42,7 @@ export default { app.config.globalProperties.$translate = key => { return key.split('.').reduce((o, i) => { if (o) return o[i] - }, i18n) + }, options) } } } @@ -67,7 +67,7 @@ export default { app.config.globalProperties.$translate = key => { return key.split('.').reduce((o, i) => { if (o) return o[i] - }, i18n) + }, options) } app.provide('i18n', options) @@ -85,7 +85,7 @@ export default { install: (app, options) => { app.config.globalProperties.$translate = (key) => { return key.split('.') - .reduce((o, i) => { if (o) return o[i] }, i18n) + .reduce((o, i) => { if (o) return o[i] }, options) } app.provide('i18n', options)