Skip to content

Commit

Permalink
refactor($i18n-ui): simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
ulivz committed Sep 24, 2018
1 parent 91ebd10 commit 0d57666
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 21 deletions.
4 changes: 3 additions & 1 deletion packages/@vuepress/plugin-i18n-ui/client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import Layout from './index.vue'
// TODO move default theme styl to core.
import '@theme/styles/theme.styl'

export default ({ Vue }) => {
Vue.component('I18nUI', Layout)
Vue.component('I18nUILayout', Layout)
}
6 changes: 4 additions & 2 deletions packages/@vuepress/plugin-i18n-ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ module.exports = (pluginOptions = {}, context) => ({

additionalPages: [
{
filePath: path.resolve(__dirname, 'index.md'),
permalink: pluginOptions.permalink || '/i18n/'
permalink: pluginOptions.permalink || '/i18n/',
frontmatter: {
'layout': 'I18nUILayout'
}
}
]
})
3 changes: 0 additions & 3 deletions packages/@vuepress/plugin-i18n-ui/index.md

This file was deleted.

19 changes: 4 additions & 15 deletions packages/@vuepress/plugin-i18n-ui/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template>
<div id="vuepress-plugin-i18n-ui">

<div class="theme-container" id="vuepress-plugin-i18n-ui">
<div class="tool-box">
<span class="select-lang">Language:&nbsp;</span>
<select>
Expand All @@ -17,18 +16,12 @@
<div class="helper-content">
<div id="left">
<transition name="slide-left">
<Content
v-if="currentPageComponent"
:page-key="key"
/>
<Content :page-key="key"/>
</transition>
</div>
<div id="right">
<transition name="slide-left">
<Content
v-if="rightPageComponent"
:page-key="rightKey"
/>
<Content :page-key="rightKey"/>
</transition>
</div>
</div>
Expand All @@ -41,16 +34,12 @@ import { findPageForPath } from '@app/util'
export default {
data () {
return {
currentPagePath: '/',
currentPageComponent: null,
rightPageComponent: null
currentPagePath: '/'
}
},
mounted () {
syncScroll()
this.loadComponent(this.key, 'currentPageComponent')
this.loadComponent(this.rightKey, 'rightPageComponent')
},
computed: {
Expand Down

0 comments on commit 0d57666

Please sign in to comment.