Skip to content

Commit

Permalink
feat(site): add github option
Browse files Browse the repository at this point in the history
  • Loading branch information
haoziqaq committed Mar 4, 2022
1 parent ce938c5 commit c275000
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/meve-cli/meve.default.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
port: 8080,
logo: './logo.svg',
defaultLanguage: 'zh-CN',
github: 'https://github.com/artsdt/meve',
highlight: {
/**
* @see https://highlightjs.org/
Expand Down
6 changes: 5 additions & 1 deletion packages/meve-cli/site/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<app-sidebar :in-small-screen="inSmallScreen || forceShowSidebar" />

<div class="site-main" :class="{'site-main-padding': !inSmallScreen && !forceShowSidebar}">
<app-header @menu-action-click="handleMenuActionClick" />
<app-header :class="{'site-header-width': !inSmallScreen && !forceShowSidebar}" @menu-action-click="handleMenuActionClick" />

<div class="site-router-view">
<router-view />
Expand Down Expand Up @@ -194,5 +194,9 @@ code {
.site-main-padding {
padding-left: 245px;
}
.site-header-width {
width: calc(100% - 245px);
}
}
</style>
24 changes: 23 additions & 1 deletion packages/meve-cli/site/components/AppHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,34 @@
<m-icon name="menu-open"/>
</m-button>
</div>
<div class="app-site-header-tail"></div>
<div class="app-site-header-tail">
<m-button
class="app-site-header-action"
round
@click="toGithub"
v-if="config.github"
>
<m-icon name="github"/>
</m-button>
</div>
</div>
</template>

<script>
export default {
name: 'AppHeader',
inject: ['config'],
methods: {
toGithub() {
window.location.href = this.config.github
}
},
mounted() {
console.log(this.config)
}
}
</script>

Expand All @@ -32,6 +53,7 @@ export default {
padding: 0 30px;
background: #fff;
border-bottom: 1px solid #eee;
transition: all .25s;
.app-site-header-action {
padding: 8px;
Expand Down
4 changes: 4 additions & 0 deletions packages/meve-cli/site/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Vue from 'vue'
import App from './App.vue'
import router from './router'
import Meve from '@meve/ui'
import config from '@config'
import '@meve/ui/es/style'
import '@meve/touch-emulator'
import AppCode from './components/AppCode'
Expand All @@ -10,6 +11,9 @@ Vue.use(Meve)
Vue.component('app-code', AppCode)

new Vue({
provide: {
config
},
router,
render: h => h(App)
}).$mount('#app')
1 change: 1 addition & 0 deletions packages/meve-icons/svg/uF024-github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c275000

Please sign in to comment.