This commit is contained in:
Hunlongyu
2019-11-29 17:51:27 +08:00
parent 632f8778a1
commit dfc16d4441
13 changed files with 274 additions and 90 deletions

View File

@@ -1,29 +1,55 @@
<template>
<div id="app">
<div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/search">search</router-link>
</div>
<router-view/>
<div id="app" :class="theme">
<Layout class="box">
<Sider class="sider" width="70"><ZYSider /></Sider>
<Layout>
<Header class="header"><ZYHeader /></Header>
<Content class="content">
<ZYContent />
<Row>
<Button type="primary" @click="switchTheme('light')">light</Button>
<Button type="primary" @click="switchTheme('dark')">Dark</Button>
</Row>
</Content>
</Layout>
</Layout>
</div>
</template>
<style lang="scss">
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
#nav {
padding: 30px;
a {
font-weight: bold;
color: #2c3e50;
&.router-link-exact-active {
color: #42b983;
<script>
import ZYSider from '@/components/zy_sider.vue'
import ZYHeader from '@/components/zy_header.vue'
import ZYContent from '@/components/zy_content.vue'
export default {
name: 'app',
data () {
return {
theme: 'light'
}
},
components: {
ZYSider,
ZYHeader,
ZYContent
},
methods: {
switchTheme (e) {
this.theme = e
}
}
}
</script>
<style lang="scss">
@import './assets/theme/dark.scss';
@import './assets/theme/light.scss';
html, body, #app, .box{
height: 100%;
}
.box{
.header{
width: 100%;
height: 35px;
padding: 0;
}
}
</style>

View File

@@ -0,0 +1,7 @@
.dark{
.sider,.header,.content{
background-color: #000;
color: #eee;
border: 1px solid #ccc;
}
}

View File

@@ -0,0 +1,24 @@
.light{
.sider,.header,.content{
background-color: #fff;
color: #000;
}
.sider{
border-right: 1px solid #dcdee2;
.sider-box{
color: #808695;
i{
&:hover{
color: #515a6e;
background-color: #efefef;
border-right: 1px solid #808695;
}
&.active{
color: #515a6e;
background-color: #efefef;
border-left: 2px solid #515a6e;
}
}
}
}
}

View File

@@ -17,8 +17,9 @@ protocol.registerSchemesAsPrivileged([{ scheme: 'app', privileges: { secure: tru
function createWindow () {
// Create the browser window.
win = new BrowserWindow({
width: 1024,
width: 1400,
height: 800,
frame: false,
webPreferences: {
webSecurity: false,
nodeIntegration: true

View File

@@ -1,58 +0,0 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

View File

@@ -0,0 +1,13 @@
<template>
<Row></Row>
</template>
<script>
export default {
name: 'zy_content',
methods: {
switchTheme (e) {
this.theme = e
}
}
}
</script>

View File

@@ -0,0 +1,47 @@
<template>
<Row class="header-box">
<div class="left">
<Icon type="md-return-left" />
</div>
<div class="right">
<Icon type="md-remove" />
<Icon type="md-add" />
<Icon type="md-close" />
</div>
</Row>
</template>
<script>
export default {
name: 'zy_header'
}
</script>
<style lang="scss" scoped>
.header-box{
height: 100%;
border: 1px solid #000;
-webkit-app-region: drag;
-webkit-user-select: none;
.left,.right{
display: inline-block;
height: 35px;
i{
-webkit-app-region: no-drag;
font-size: 20px;
width:35px;
height:35px;
line-height:35px;
cursor: pointer;
background-color: #aaa;
}
}
.left{
top: 0;
left: 0;
}
.right{
position: absolute;
top: 0;
right: 0;
}
}
</style>

View File

@@ -0,0 +1,38 @@
<template>
<Row class="sider-box">
<div class="top">
<Icon class="active" type="md-list" />
<Icon type="md-search" />
<Icon type="md-play" />
<Icon type="md-star" />
</div>
<div class="bottom">
<Icon type="md-settings" />
</div>
</Row>
</template>
<script>
export default {
name: 'zy-sider'
}
</script>
<style lang="scss" scoped>
.sider-box{
height: 100%;
position: relative;
-webkit-app-region: drag;
-webkit-user-select: none;
.bottom{
position: absolute;
bottom: 0;
}
i{
-webkit-app-region: no-drag;
font-size: 32px;
width: 70px;
height: 70px;
line-height: 70px;
cursor: pointer;
}
}
</style>

View File

@@ -2,7 +2,9 @@ import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// import 'modern-normalize'
import '@/plugin/iview/'
// import '@/assets/theme/dark.scss'
// import '@/assets/theme/light.scss'
Vue.config.productionTip = false

15
src/plugin/iview/index.js Normal file
View File

@@ -0,0 +1,15 @@
import Vue from 'vue'
import 'view-design/dist/styles/iview.css'
import {
Layout, Sider, Header, Content, Row, Col,
Icon, Button
} from 'view-design'
Vue.component('Layout', Layout)
Vue.component('Sider', Sider)
Vue.component('Header', Header)
Vue.component('Content', Content)
Vue.component('Row', Row)
Vue.component('Col', Col)
Vue.component('Icon', Icon)
Vue.component('Button', Button)