From 859dc19b06a4fe84fd5c114c023816f2e88a5064 Mon Sep 17 00:00:00 2001 From: tjz <415800467@qq.com> Date: Sat, 7 Apr 2018 15:22:47 +0800 Subject: [PATCH] fix site --- site/components/demoBox.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/site/components/demoBox.vue b/site/components/demoBox.vue index d1bd6519c..9dcc67acc 100644 --- a/site/components/demoBox.vue +++ b/site/components/demoBox.vue @@ -53,11 +53,12 @@ export default { `not have usTitle`, ) } - let id = ['components', name.replace('-cn', ''), 'demo', ...usTitle.split(' ')].join('-').toLowerCase() - + const component = this.$slots.component[0] + const fileName = (component.context.$vnode.componentOptions.Ctor.extendOptions.__file.split('/demo/')[1] || '').replace('.md', '') + const id = ['components', name.replace('-cn', ''), 'demo', fileName].join('-').toLowerCase() + console.log(fileName) if (this._store.store) { const { currentSubMenu } = this._store.store.getState() - id = `${id}-${currentSubMenu.length + 1}` this._store.store.setState({ currentSubMenu: [...currentSubMenu, { cnTitle, usTitle, id }] }) } return {