Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdb6a8ac

Browse files
committed
配置less
1 parent082c58e commitdb6a8ac

File tree

10 files changed

+686
-422
lines changed

10 files changed

+686
-422
lines changed

‎build/webpack.base.conf.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ module.exports = {
4646
loader:'vue-loader',
4747
options:vueLoaderConfig
4848
},
49+
{
50+
test:/\.less$/,
51+
loader:"style-loader!css-loader!less-loader",
52+
},
4953
{
5054
test:/\.js$/,
5155
loader:'babel-loader',

‎package-lock.json‎

Lines changed: 209 additions & 28 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
"axios":"^0.19.2",
1818
"element-ui":"^2.13.1",
1919
"highlight.js":"^10.0.2",
20+
"less":"^3.12.2",
21+
"less-loader":"^4.1.0",
2022
"marked":"^1.0.0",
2123
"mavon-editor":"^2.9.0",
2224
"vue":"^2.5.2",

‎src/components/nav.vue‎

Lines changed: 118 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,99 @@
11
<template>
2-
<divclass="nav">
3-
<divclass="nav-content">
4-
<divclass="nav-rows">
5-
<el-row>
6-
<el-col:span="3">
7-
<router-linkto="/">
8-
<imgclass="logo"
9-
src="../assets/avat.jpg"
10-
alt="">
11-
</router-link>
12-
</el-col>
13-
<el-col:span="16">
14-
<ul>
15-
<liclass="item">
16-
<router-linkto="/">首页</router-link>
17-
</li>
18-
<liclass="item">
19-
<router-linkto="/article">文章</router-link>
20-
</li>
21-
<liclass="item">
22-
<router-linkto="/">归档</router-link>
23-
</li>
24-
<liclass="item">
25-
<router-linkto="/">留言</router-link>
26-
</li>
27-
<liclass="item">
28-
<router-linkto="/">关于</router-link>
29-
</li>
30-
</ul>
31-
</el-col>
32-
<el-col:span="4">
33-
<divclass="nav-right">
34-
<el-buttonsize="small"
35-
type="primary">登录</el-button>
36-
<el-buttonsize="small"
37-
type="danger">注册</el-button>
2+
<divclass="nav">
3+
<divclass="nav-content">
4+
<divclass="nav-rows">
5+
<el-row>
6+
<el-col:span="3">
7+
<router-linkto="/">
8+
<imgclass="logo"src="../assets/avat.jpg"alt="" />
9+
</router-link>
10+
</el-col>
11+
<el-col:span="12">
12+
<ul>
13+
<el-menu
14+
:router="true"
15+
:default-active="activeIndex"
16+
active-text-color="#409eff"
17+
mode="horizontal"
18+
@select="handleSelect"
19+
>
20+
<el-menuItem
21+
:route="item.path"
22+
:index="item.index"
23+
v-for="(item, index) in navList"
24+
:key="index"
25+
>
26+
{{ item.name }}
27+
</el-menuItem>
28+
</el-menu>
29+
</ul>
30+
</el-col>
31+
<el-col:span="4">
32+
<el-input
33+
v-model="input"
34+
placeholder="请输入内容"
35+
></el-input>
36+
</el-col>
37+
<el-col:span="4">
38+
<divclass="nav-right">
39+
<el-buttonsize="small"type="primary"
40+
>登录</el-button
41+
>
42+
<el-buttonsize="small"type="danger"
43+
>注册</el-button
44+
>
45+
</div>
46+
</el-col>
47+
</el-row>
3848
</div>
39-
</el-col>
40-
</el-row>
41-
</div>
49+
</div>
4250
</div>
43-
</div>
4451
</template>
4552

4653
<script>
4754
exportdefault {
48-
data () {
49-
return {
50-
}
51-
}
55+
data() {
56+
return {
57+
input:'',
58+
activeIndex:'0',
59+
navList: [
60+
{
61+
index:'0',
62+
path:'/',
63+
name:'首页',
64+
},
65+
{
66+
index:'1',
67+
path:'/articles',
68+
name:'文章',
69+
},
70+
{
71+
index:'2',
72+
path:'/archive',
73+
name:'归档',
74+
},
75+
{
76+
index:'3',
77+
path:'/message',
78+
name:'留言',
79+
},
80+
{
81+
index:'4',
82+
path:'/about',
83+
name:'关于',
84+
},
85+
],
86+
}
87+
},
88+
methods: {
89+
handleSelect(val) {
90+
this.activeIndex= val
91+
},
92+
},
5293
}
5394
</script>
5495

55-
<style scoped>
96+
<style scoped lang="less">
5697
.nav {
5798
position:fixed;
5899
top:0;
@@ -62,76 +103,37 @@ export default {
62103
height:60px;
63104
border-bottom:1pxsolid#eee;
64105
background-color:#fff;
65-
}
66-
.nav-content {
67-
width:1200px;
68-
height:100%;
69-
margin:0auto;
70-
}
71-
.nav-rows {
72-
position:relative;
73-
height:100%;
74-
-webkit-box-sizing:border-box;
75-
box-sizing:border-box;
76-
margin-left:-10px;
77-
margin-right:-10px;
78-
}
79-
.logo {
80-
height:60px;
81-
width:60px;
82-
border-radius:50%;
83-
}
84-
85-
.item {
86-
float:left;
87-
height:60px;
88-
line-height:60px;
89-
border-bottom:2pxsolidtransparent;
90-
color:#909399;
91-
font-size:14px;
92-
padding:020px;
93-
transition: border-color0.3s, background-color0.3s,color0.3s;
94-
box-sizing:border-box;
95-
}
96-
.item>a:hover {
97-
cursor:pointer;
98-
}
99-
.nav-right {
100-
position:relative;
101-
padding-top:15px;
102-
text-align:right;
103-
}
104-
.login-button {
105-
line-height:1;
106-
padding:9px15px;
107-
font-size:12px;
108-
border-radius:3px;
109-
color:#fff;
110-
background-color:#409eff;
111-
border-color:#409eff;
112-
margin:0;
113-
outline:0;
114-
display:inline-block;
115-
white-space:nowrap;
116-
cursor:pointer;
117-
border:1pxsolid#dcdfe6;
118-
box-sizing:border-box;
119-
text-align:center;
120-
}
121-
.register-button {
122-
line-height:1;
123-
margin-left:10px;
124-
padding:9px15px;
125-
font-size:12px;
126-
border-radius:3px;
127-
color:#fff;
128-
background-color:#f56c6c;
129-
border-color:#f56c6c;
130-
outline:0;
131-
display:inline-block;
132-
white-space:nowrap;
133-
cursor:pointer;
134-
border:1pxsolid#dcdfe6;
135-
box-sizing:border-box;
106+
.nav-content {
107+
width:1200px;
108+
height:100%;
109+
margin:0auto;
110+
.nav-rows {
111+
position:relative;
112+
height:100%;
113+
-webkit-box-sizing:border-box;
114+
box-sizing:border-box;
115+
margin-left:-10px;
116+
margin-right:-10px;
117+
.logo {
118+
height:60px;
119+
width:60px;
120+
border-radius:50%;
121+
}
122+
.el-menu.el-menu--horizontal {
123+
border-bottom:none;
124+
}
125+
.el-menu--horizontal>.el-menu-item {
126+
cursor:pointer;
127+
&:hover {
128+
color:rgb(64,158,255);
129+
}
130+
}
131+
}
132+
.nav-right {
133+
position:relative;
134+
padding-top:15px;
135+
text-align:right;
136+
}
137+
}
136138
}
137139
</style>

‎src/components/pagination.vue‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<template lang="html">
2+
<divclass="pages">
3+
<el-pagination
4+
@size-change="handleSizeChange"
5+
@current-change="handleCurrentChange"
6+
:current-page="currentPage"
7+
:page-size="pageSize"
8+
:page-sizes="pageSizes"
9+
layout="total, sizes, prev, pager, next, jumper"
10+
background
11+
:total="totalPage"
12+
></el-pagination>
13+
</div>
14+
</template>
15+
16+
<script>
17+
exportdefault {
18+
data() {
19+
return {}
20+
},
21+
name:'pagination',
22+
props: {
23+
pageSizes: {
24+
type:Array,
25+
default() {
26+
return [10,20,30,40,50,100,300,500]
27+
},
28+
},
29+
pageSize: {
30+
type:Number,
31+
default:10,
32+
},
33+
totalPage:Number,
34+
currentPage:Number,
35+
},
36+
methods: {
37+
handleSizeChange(e) {
38+
this.$emit('handleSizeChange', e)
39+
},
40+
handleCurrentChange(e) {
41+
this.$emit('handleCurrentChange', e)
42+
},
43+
},
44+
}
45+
</script>
46+
47+
<style lang="less" scoped>
48+
.pages {
49+
padding:20px0;
50+
text-align:center;
51+
}
52+
</style>

‎src/router/index.js‎

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
importVuefrom'vue'
22
importRouterfrom'vue-router'
3-
constarticle=()=>import('@/views/articles')
4-
constarticleDetail=()=>import('@/views/articleDetail')
5-
constaddArticle=()=>import('@/views/newArticle')
3+
constarticle=()=>import('@/views/article/articles')
4+
constarticleDetail=()=>import('@/views/article/articleDetail')
5+
//const addArticle = () => import('@/views/newArticle')
66
constindex=()=>import('@/views/index')
77

88
Vue.use(Router)
@@ -11,25 +11,41 @@ export default new Router({
1111
routes:[
1212
{
1313
path:'/',
14+
name:'',
15+
redirect:'/index/article/list',
16+
},
17+
{
18+
path:'/index',
1419
name:'index',
1520
component:index,
16-
redirect:'/article',
21+
redirect:'/index/article/list',
1722
children:[
1823
{
1924
path:'article',
2025
name:'article',
21-
component:article,
22-
},
23-
{
24-
path:'articleDetail',
25-
name:'articleDetail',
26-
component:articleDetail,
27-
},
28-
{
29-
path:'addArticle',
30-
name:'addArticle',
31-
component:addArticle,
26+
redirect:'/index/article/list',
27+
component:{
28+
template:'<div><router-view></router-view></div>',
29+
},
30+
children:[
31+
{
32+
path:'list',
33+
name:'list',
34+
component:article,
35+
},
36+
{
37+
path:'detail',
38+
name:'detail',
39+
component:articleDetail,
40+
},
41+
],
3242
},
43+
44+
// {
45+
// path: 'addArticle',
46+
// name: 'addArticle',
47+
// component: addArticle,
48+
// },
3349
],
3450
},
3551
],

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp