Skip to content

Commit

Permalink
初次提交,多多见谅
Browse files Browse the repository at this point in the history
  • Loading branch information
frontHu committed Aug 31, 2018
0 parents commit 85adc27
Show file tree
Hide file tree
Showing 14 changed files with 414 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.DS_Store
node_modules
/dist

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# backend

## Project setup
```
npm install
```

### Compiles and hot-reloads for development
```
npm run serve
```

### Compiles and minifies for production
```
npm run build
```

### Lints and fixes files
```
npm run lint
```
14 changes: 14 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
presets: [
'@vue/app'
],
plugins: [
[
"component",
{
"libraryName": "element-ui",
"styleLibraryName": "theme-chalk"
}
]
]
}
48 changes: 48 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "backend",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"element-ui": "^2.4.6",
"vue": "^2.5.17",
"vue-router": "^3.0.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.0.1",
"@vue/cli-plugin-eslint": "^3.0.1",
"@vue/cli-service": "^3.0.1",
"babel-plugin-component": "^1.1.1",
"node-sass": "^4.9.3",
"sass-loader": "^7.1.0",
"vue-template-compiler": "^2.5.17"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
}
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
Binary file added public/favicon.ico
Binary file not shown.
17 changes: 17 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>小小胡的Backend</title>
</head>
<body>
<noscript>
<strong>We're sorry but backend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
28 changes: 28 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<template>
<router-view></router-view>
</template>
<script>
export default {
name: 'app'
}
</script>

<style>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
html, body {
width: 100%;
height: 100%;
}
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
Binary file added src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions src/components/Slider/Menu.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<template>
<li>
<span @click="toggle(model.menuName,model.menuUrl,model.menuPath)">
<i v-if="!isFolder" class="icon file-text">●</i>
{{ model.menuName }}
<i v-if="isFolder" class="icon" :class="[open ? 'folder-open': 'folder']"></i>
</span>
<ul v-show="open" v-if="isFolder">
<Menu v-for="item in model.childMenus" :model="item" :key="item.menuId"></Menu>
</ul>
</li>
</template>

<script>
export default {
name: "Menu",
data() {
return {
open: false,
}
},
props: ['model'],
computed: {
isFolder() {
return this.model.childMenus && this.model.childMenus.length
}
},
methods: {
toggle(msg,menuUrl,menuPath) {
if(this.isFolder) {
this.open = !this.open
}
}
}
}
</script>

<style lang='scss' scoped>
.menu {
width: 100%;
height: 46px;
line-height: 46px;
background-color: rgb(67, 74, 80);
padding-left: 20px;
color: #fff;
}
</style>
80 changes: 80 additions & 0 deletions src/components/Slider/Slider.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<template>
<div class="slider">
<div class="silder-header"></div>
<div class="slider-list">
<ul v-for="menuItem in theModel">
<Menu :model="menuItem"></Menu>
</ul>
</div>
</div>
</template>

<script>
import Menu from "./Menu.vue";
export default {
name: "Slider",
data() {
return {
theModel: [
{
id: "1",
menuName: "导航1",
menuCode: "10",
childMenus: [
{
menuName: "用户管理",
menuCode: "11",
childMenus: [
{
menuName: "11111",
menuCode: "12",
childMenus: []
}
]
},
{
menuName: "角色管理",
menuCode: "12",
childMenus: []
},
{
menuName: "菜单管理",
menuCode: "13",
childMenus: []
}
]
},
{
id: "1",
menuName: "导航2",
menuCode: "10",
childMenus: []
}
]
};
},
components: {
Menu: Menu
}
};
</script>

<style scoped lang='scss'>
.slider {
width: 256px;
height: 100%;
background-color: rgb(84, 92, 100); //67,74,80
position: fixed;
left: 0;
top: 0;
bottom: 0;
.silder-header {
width: 100%;
height: 64px;
background-color: #002140;
}
.slider-list {
padding: 10px 0;
}
}
</style>
14 changes: 14 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Vue from 'vue'
import App from './App.vue'
import router from './router/router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

Vue.use(ElementUI);
Vue.config.productionTip = false

new Vue({
el: '#app',
router,
render: h => h(App)
})
22 changes: 22 additions & 0 deletions src/page/Home/Home.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<template>
<div class="home">
<Slider></Slider>
</div>
</template>

<script>
import Slider from './../../components/Slider/Slider.vue'
export default {
name: 'Home',
components: {
Slider: Slider
}
}
</script>

<style scoped>
.home {
width: 100%;
height: 100%;
}
</style>
Loading

0 comments on commit 85adc27

Please sign in to comment.