使用Vue cli 4搭建管理控台

使用vue cli创建admin项目

设置命令窗口为git的

使用vue cli新建admin项目,目前版本是4.1.2

1
2
3
npm install -g @vue/cli@4.1.2

vue create admin

集成bootstrap后台管理模板ace

加入ace admin模板

见Ace模块

public/index.html中加入ace admin模板所需要的js css

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>Login Page - Ace Admin</title>

<meta name="description" content="User login page" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

<!-- bootstrap & fontawesome -->
<link rel="stylesheet" href="<%= BASE_URL %>ace/assets/css/bootstrap.min.css" />
<link rel="stylesheet" href="<%= BASE_URL %>ace/assets/font-awesome/4.5.0/css/font-awesome.min.css" />

<!-- text fonts -->
<link rel="stylesheet" href="<%= BASE_URL %>ace/assets/css/fonts.googleapis.com.css" />

<!-- ace styles -->
<link rel="stylesheet" href="<%= BASE_URL %>ace/assets/css/ace.min.css" />

<!--[if lte IE 9]>
<link rel="stylesheet" href="<%= BASE_URL %>ace/assets/css/ace-part2.min.css" />
<![endif]-->
<link rel="stylesheet" href="<%= BASE_URL %>ace/assets/css/ace-rtl.min.css" />

<!--[if lte IE 9]>
<link rel="stylesheet" href="<%= BASE_URL %>ace/assets/css/ace-ie.min.css" />
<![endif]-->

<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->

<!--[if lte IE 8]>
<script src="<%= BASE_URL %>ace/assets/js/html5shiv.min.js"></script>
<script src="<%= BASE_URL %>ace/assets/js/respond.min.js"></script>
<![endif]-->

<!--[if !IE]> -->
<script src="<%= BASE_URL %>ace/assets/js/jquery-2.1.4.min.js"></script>

<!-- <![endif]-->

<!--[if IE]>
<script src="<%= BASE_URL %>ace/assets/js/jquery-1.11.3.min.js"></script>
<![endif]-->
<script type="text/javascript">
if('ontouchstart' in document.documentElement) document.write("<script src='assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
</script>

</head>
<body>
<noscript>
<strong>We're sorry but admin 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>

在App.vue中加入登录页面的元素

admin/src/App.vue

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<template>
<div className="main-container">
<div className="main-content">
<div className="row">
<div className="col-sm-10 col-sm-offset-1">
<div className="login-container">
<div className="center">
<h1>
<i className="ace-icon fa fa-leaf green"></i>
<span className="red">Ace</span>
<span className="white" id="id-text2">Application</span>
</h1>
<h4 className="blue" id="id-company-text">&copy; Company Name</h4>
</div>

<div className="space-6"></div>

<div className="position-relative">
<div id="login-box" className="login-box visible widget-box no-border">
<div className="widget-body">
<div className="widget-main">
<h4 className="header blue lighter bigger">
<i className="ace-icon fa fa-coffee green"></i>
Please Enter Your Information
</h4>

<div className="space-6"></div>

<form>
<fieldset>
<label className="block clearfix">
<span className="block input-icon input-icon-right">
<input type="text" className="form-control" placeholder="Username"/>
<i className="ace-icon fa fa-user"></i>
</span>
</label>

<label className="block clearfix">
<span className="block input-icon input-icon-right">
<input type="password" className="form-control" placeholder="Password"/>
<i className="ace-icon fa fa-lock"></i>
</span>
</label>

<div className="space"></div>

<div className="clearfix">
<label className="inline">
<input type="checkbox" className="ace"/>
<span className="lbl"> Remember Me</span>
</label>

<button type="button" className="width-35 pull-right btn btn-sm btn-primary">
<i className="ace-icon fa fa-key"></i>
<span className="bigger-110">Login</span>
</button>
</div>

<div className="space-4"></div>
</fieldset>
</form>

<div className="social-or-login center">
<span className="bigger-110">Or Login Using</span>
</div>

<div className="space-6"></div>

<div className="social-login center">
<a className="btn btn-primary">
<i className="ace-icon fa fa-facebook"></i>
</a>

<a className="btn btn-info">
<i className="ace-icon fa fa-twitter"></i>
</a>

<a className="btn btn-danger">
<i className="ace-icon fa fa-google-plus"></i>
</a>
</div>
</div><!-- /.widget-main -->

<div className="toolbar clearfix">
<div>
<a href="#" data-target="#forgot-box" className="forgot-password-link">
<i className="ace-icon fa fa-arrow-left"></i>
I forgot my password
</a>
</div>

<div>
<a href="#" data-target="#signup-box" className="user-signup-link">
I want to register
<i className="ace-icon fa fa-arrow-right"></i>
</a>
</div>
</div>
</div><!-- /.widget-body -->
</div><!-- /.login-box -->

<div id="forgot-box" className="forgot-box widget-box no-border">
<div className="widget-body">
<div className="widget-main">
<h4 className="header red lighter bigger">
<i className="ace-icon fa fa-key"></i>
Retrieve Password
</h4>

<div className="space-6"></div>
<p>
Enter your email and to receive instructions
</p>

<form>
<fieldset>
<label className="block clearfix">
<span className="block input-icon input-icon-right">
<input type="email" className="form-control" placeholder="Email"/>
<i className="ace-icon fa fa-envelope"></i>
</span>
</label>

<div className="clearfix">
<button type="button" className="width-35 pull-right btn btn-sm btn-danger">
<i className="ace-icon fa fa-lightbulb-o"></i>
<span className="bigger-110">Send Me!</span>
</button>
</div>
</fieldset>
</form>
</div><!-- /.widget-main -->

<div className="toolbar center">
<a href="#" data-target="#login-box" className="back-to-login-link">
Back to login
<i className="ace-icon fa fa-arrow-right"></i>
</a>
</div>
</div><!-- /.widget-body -->
</div><!-- /.forgot-box -->

<div id="signup-box" className="signup-box widget-box no-border">
<div className="widget-body">
<div className="widget-main">
<h4 className="header green lighter bigger">
<i className="ace-icon fa fa-users blue"></i>
New User Registration
</h4>

<div className="space-6"></div>
<p> Enter your details to begin: </p>

<form>
<fieldset>
<label className="block clearfix">
<span className="block input-icon input-icon-right">
<input type="email" className="form-control" placeholder="Email"/>
<i className="ace-icon fa fa-envelope"></i>
</span>
</label>

<label className="block clearfix">
<span className="block input-icon input-icon-right">
<input type="text" className="form-control" placeholder="Username"/>
<i className="ace-icon fa fa-user"></i>
</span>
</label>

<label className="block clearfix">
<span className="block input-icon input-icon-right">
<input type="password" className="form-control" placeholder="Password"/>
<i className="ace-icon fa fa-lock"></i>
</span>
</label>

<label className="block clearfix">
<span className="block input-icon input-icon-right">
<input type="password" className="form-control" placeholder="Repeat password"/>
<i className="ace-icon fa fa-retweet"></i>
</span>
</label>

<label className="block">
<input type="checkbox" className="ace"/>
<span className="lbl">
I accept the
<a href="#">User Agreement</a>
</span>
</label>

<div className="space-24"></div>

<div className="clearfix">
<button type="reset" className="width-30 pull-left btn btn-sm">
<i className="ace-icon fa fa-refresh"></i>
<span className="bigger-110">Reset</span>
</button>

<button type="button" className="width-65 pull-right btn btn-sm btn-success">
<span className="bigger-110">Register</span>

<i className="ace-icon fa fa-arrow-right icon-on-right"></i>
</button>
</div>
</fieldset>
</form>
</div>

<div className="toolbar center">
<a href="#" data-target="#login-box" className="back-to-login-link">
<i className="ace-icon fa fa-arrow-left"></i>
Back to login
</a>
</div>
</div><!-- /.widget-body -->
</div><!-- /.signup-box -->
</div><!-- /.position-relative -->

<div className="navbar-fixed-top align-right">
<br/>
&nbsp;
<a id="btn-login-dark" href="#">Dark</a>
&nbsp;
<span className="blue">/</span>
&nbsp;
<a id="btn-login-blur" href="#">Blur</a>
&nbsp;
<span className="blue">/</span>
&nbsp;
<a id="btn-login-light" href="#">Light</a>
&nbsp; &nbsp; &nbsp;
</div>
</div>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.main-content -->
</div><!-- /.main-container -->
</template>

<script>
$('body').attr('class', 'login-layout light-login');
export default {
name: 'app',
}
</script>

简化登录页面代码

简化登录页面代码

增加eslintrc.js,去掉部分检查项,解决修改代码自动编译时报错:$ is not defined

admin/.eslintrc.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'eslint:recommended'
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-undef': 'off',
'vue/no-unused-vars': 'off',
'vue/require-v-for-key': 'off'
},
parserOptions: {
parser: 'babel-eslint'
}
};

admin/src/App.vue

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<template>
<div class="main-container">
<div class="main-content">
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<div class="login-container">
<div class="center">
<h1>
<i class="ace-icon fa fa-leaf green"></i>
<span class="">控台登录</span>
</h1>
</div>

<div class="space-6"></div>

<div class="position-relative">
<div id="login-box" class="login-box visible widget-box no-border">
<div class="widget-body">
<div class="widget-main">
<h4 class="header blue lighter bigger">
<i class="ace-icon fa fa-coffee green"></i>
请输入用户名密码
</h4>

<div class="space-6"></div>

<form>
<fieldset>
<label class="block clearfix">
<span class="block input-icon input-icon-right">
<input type="text" class="form-control" placeholder="Username" />
<i class="ace-icon fa fa-user"></i>
</span>
</label>

<label class="block clearfix">
<span class="block input-icon input-icon-right">
<input type="password" class="form-control" placeholder="Password" />
<i class="ace-icon fa fa-lock"></i>
</span>
</label>

<div class="space"></div>

<div class="clearfix">
<label class="inline">
<input type="checkbox" class="ace" />
<span class="lbl">记住我</span>
</label>

<button type="button" class="width-35 pull-right btn btn-sm btn-primary">
<i class="ace-icon fa fa-key"></i>
<span class="bigger-110">登录</span>
</button>
</div>

<div class="space-4"></div>
</fieldset>
</form>

</div><!-- /.widget-main -->

</div><!-- /.widget-body -->
</div><!-- /.login-box -->
</div><!-- /.position-relative -->

</div>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.main-content -->
</div><!-- /.main-container -->
</template>

<script>
$('body').attr('class', 'login-layout light-login');
export default {
name: 'app',
}
</script>

集成路由vue-router

安装vue-router

1
npm install vue-router --save

增加login页面

1.增加login页面
2.增加路由配置,访问/login时,加载login组件

增加admin页面

  1. 增加admin页面
  2. 增加路由配置,访问/admin时,加载admin组件

增加login页面登录按钮点击事件,跳转到admin页面

1
2
3
4
5
6
7
8
export default {
name: 'login',
methods: {
login () {
this.$router.push("/admin")
}
}
}

控台欢迎页面开发

使用mounted解决组件初始化样式的问题

admin/src/views/admin.vue

1
2
3
4
5
6
7
8
9
10
11
12
13
export default {
name: "admin",
mounted: function() {
$("body").removeClass("login-layout light-login");
$("body").attr("class", "no-skin");
// console.log("admin");
},
methods: {
login () {
this.$router.push("/admin")
}
}
}

admin/src/views/login.vue

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<script>
export default {
name: "login",
mounted: function() {
$("body").removeClass("no-skin");
$("body").attr("class", "login-layout light-login");
// console.log("login");
},
methods: {
login () {
this.$router.push("/admin")
}
}
}
</script>

增加welcome子组件,增加/admin/welcome子路由

增加welcome子组件,增加/admin/welcome子路由,router-view和子路由配合使用
注意:子路由的配置不要“/”开头

admin/src/router.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import Vue from 'vue'
import Router from 'vue-router'
import Login from './views/login.vue'
import Admin from './views/admin.vue'
import Welcome from './views/admin/welcome.vue'

Vue.use(Router);

export default new Router({
mode: 'history',
base: process.env.BASE_URL,
routes: [{
path: '/admin',
component: Admin,
children: [{
path: 'welcome',
component: Welcome,
}]
}]
})

1.将面包屑导航、搜索、设置删除
2.侧边栏去掉无用的菜单
3.底部文案修改
4. 使用相对路径解决头像路径问题
admin/src/views/admin.vue

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
<template>
<div>
<div id="navbar" class="navbar navbar-default ace-save-state">
<div class="navbar-container ace-save-state" id="navbar-container">
<button type="button" class="navbar-toggle menu-toggler pull-left" id="menu-toggler" data-target="#sidebar">
<span class="sr-only">Toggle sidebar</span>

<span class="icon-bar"></span>

<span class="icon-bar"></span>

<span class="icon-bar"></span>
</button>

<div class="navbar-header pull-left">
<a href="index.html" class="navbar-brand">
<small>
<i class="fa fa-leaf"></i>
在线视频课程
</small>
</a>
</div>

<div class="navbar-buttons navbar-header pull-right" role="navigation">
<ul class="nav ace-nav">
<li class="grey dropdown-modal">
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
<i class="ace-icon fa fa-tasks"></i>
<span class="badge badge-grey">4</span>
</a>

<ul class="dropdown-menu-right dropdown-navbar dropdown-menu dropdown-caret dropdown-close">
<li class="dropdown-header">
<i class="ace-icon fa fa-check"></i>
4 Tasks to complete
</li>

<li class="dropdown-content">
<ul class="dropdown-menu dropdown-navbar">
<li>
<a href="#">
<div class="clearfix">
<span class="pull-left">Software Update</span>
<span class="pull-right">65%</span>
</div>

<div class="progress progress-mini">
<div style="width:65%" class="progress-bar"></div>
</div>
</a>
</li>

<li>
<a href="#">
<div class="clearfix">
<span class="pull-left">Hardware Upgrade</span>
<span class="pull-right">35%</span>
</div>

<div class="progress progress-mini">
<div style="width:35%" class="progress-bar progress-bar-danger"></div>
</div>
</a>
</li>

<li>
<a href="#">
<div class="clearfix">
<span class="pull-left">Unit Testing</span>
<span class="pull-right">15%</span>
</div>

<div class="progress progress-mini">
<div style="width:15%" class="progress-bar progress-bar-warning"></div>
</div>
</a>
</li>

<li>
<a href="#">
<div class="clearfix">
<span class="pull-left">Bug Fixes</span>
<span class="pull-right">90%</span>
</div>

<div class="progress progress-mini progress-striped active">
<div style="width:90%" class="progress-bar progress-bar-success"></div>
</div>
</a>
</li>
</ul>
</li>

<li class="dropdown-footer">
<a href="#">
See tasks with details
<i class="ace-icon fa fa-arrow-right"></i>
</a>
</li>
</ul>
</li>

<li class="purple dropdown-modal">
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
<i class="ace-icon fa fa-bell icon-animated-bell"></i>
<span class="badge badge-important">8</span>
</a>

<ul class="dropdown-menu-right dropdown-navbar navbar-pink dropdown-menu dropdown-caret dropdown-close">
<li class="dropdown-header">
<i class="ace-icon fa fa-exclamation-triangle"></i>
8 Notifications
</li>

<li class="dropdown-content">
<ul class="dropdown-menu dropdown-navbar navbar-pink">
<li>
<a href="#">
<div class="clearfix">
<span class="pull-left">
<i class="btn btn-xs no-hover btn-pink fa fa-comment"></i>
New Comments
</span>
<span class="pull-right badge badge-info">+12</span>
</div>
</a>
</li>

<li>
<a href="#">
<i class="btn btn-xs btn-primary fa fa-user"></i>
Bob just signed up as an editor ...
</a>
</li>

<li>
<a href="#">
<div class="clearfix">
<span class="pull-left">
<i class="btn btn-xs no-hover btn-success fa fa-shopping-cart"></i>
New Orders
</span>
<span class="pull-right badge badge-success">+8</span>
</div>
</a>
</li>

<li>
<a href="#">
<div class="clearfix">
<span class="pull-left">
<i class="btn btn-xs no-hover btn-info fa fa-twitter"></i>
Followers
</span>
<span class="pull-right badge badge-info">+11</span>
</div>
</a>
</li>
</ul>
</li>

<li class="dropdown-footer">
<a href="#">
See all notifications
<i class="ace-icon fa fa-arrow-right"></i>
</a>
</li>
</ul>
</li>

<li class="green dropdown-modal">
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
<i class="ace-icon fa fa-envelope icon-animated-vertical"></i>
<span class="badge badge-success">5</span>
</a>

<ul class="dropdown-menu-right dropdown-navbar dropdown-menu dropdown-caret dropdown-close">
<li class="dropdown-header">
<i class="ace-icon fa fa-envelope-o"></i>
5 Messages
</li>

<li class="dropdown-content">
<ul class="dropdown-menu dropdown-navbar">
<li>
<a href="#" class="clearfix">
<img src="../../public/ace/assets/images/avatars/avatar.png" class="msg-photo" alt="Alex's Avatar" />
<span class="msg-body">
<span class="msg-title">
<span class="blue">Alex:</span>
Ciao sociis natoque penatibus et auctor ...
</span>

<span class="msg-time">
<i class="ace-icon fa fa-clock-o"></i>
<span>a moment ago</span>
</span>
</span>
</a>
</li>

<li>
<a href="#" class="clearfix">
<img src="../../public/ace/assets/images/avatars/avatar3.png" class="msg-photo" alt="Susan's Avatar" />
<span class="msg-body">
<span class="msg-title">
<span class="blue">Susan:</span>
Vestibulum id ligula porta felis euismod ...
</span>

<span class="msg-time">
<i class="ace-icon fa fa-clock-o"></i>
<span>20 minutes ago</span>
</span>
</span>
</a>
</li>

<li>
<a href="#" class="clearfix">
<img src="../../public/ace/assets/images/avatars/avatar4.png" class="msg-photo" alt="Bob's Avatar" />
<span class="msg-body">
<span class="msg-title">
<span class="blue">Bob:</span>
Nullam quis risus eget urna mollis ornare ...
</span>

<span class="msg-time">
<i class="ace-icon fa fa-clock-o"></i>
<span>3:15 pm</span>
</span>
</span>
</a>
</li>

<li>
<a href="#" class="clearfix">
<img src="../../public/ace/assets/images/avatars/avatar2.png" class="msg-photo" alt="Kate's Avatar" />
<span class="msg-body">
<span class="msg-title">
<span class="blue">Kate:</span>
Ciao sociis natoque eget urna mollis ornare ...
</span>

<span class="msg-time">
<i class="ace-icon fa fa-clock-o"></i>
<span>1:33 pm</span>
</span>
</span>
</a>
</li>

<li>
<a href="#" class="clearfix">
<img src="../../public/ace/assets/images/avatars/avatar5.png" class="msg-photo" alt="Fred's Avatar" />
<span class="msg-body">
<span class="msg-title">
<span class="blue">Fred:</span>
Vestibulum id penatibus et auctor ...
</span>

<span class="msg-time">
<i class="ace-icon fa fa-clock-o"></i>
<span>10:09 am</span>
</span>
</span>
</a>
</li>
</ul>
</li>

<li class="dropdown-footer">
<a href="inbox.html">
See all messages
<i class="ace-icon fa fa-arrow-right"></i>
</a>
</li>
</ul>
</li>

<li class="light-blue dropdown-modal">
<a data-toggle="dropdown" href="#" class="dropdown-toggle">
<img class="nav-user-photo" src="../../public/ace/assets/images/avatars/user.jpg" alt="Jason's Photo" />
<span class="user-info">
<small>Welcome,</small>
Jason
</span>

<i class="ace-icon fa fa-caret-down"></i>
</a>

<ul class="user-menu dropdown-menu-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
<li>
<a href="#">
<i class="ace-icon fa fa-cog"></i>
Settings
</a>
</li>

<li>
<a href="profile.html">
<i class="ace-icon fa fa-user"></i>
Profile
</a>
</li>

<li class="divider"></li>

<li>
<a href="#">
<i class="ace-icon fa fa-power-off"></i>
Logout
</a>
</li>
</ul>
</li>
</ul>
</div>
</div><!-- /.navbar-container -->
</div>

<div class="main-container ace-save-state" id="main-container">
<div id="sidebar" class="sidebar responsive ace-save-state">

<div class="sidebar-shortcuts" id="sidebar-shortcuts">
<div class="sidebar-shortcuts-large" id="sidebar-shortcuts-large">
<button class="btn btn-success">
<i class="ace-icon fa fa-signal"></i>
</button>

<button class="btn btn-info">
<i class="ace-icon fa fa-pencil"></i>
</button>

<button class="btn btn-warning">
<i class="ace-icon fa fa-users"></i>
</button>

<button class="btn btn-danger">
<i class="ace-icon fa fa-cogs"></i>
</button>
</div>

<div class="sidebar-shortcuts-mini" id="sidebar-shortcuts-mini">
<span class="btn btn-success"></span>

<span class="btn btn-info"></span>

<span class="btn btn-warning"></span>

<span class="btn btn-danger"></span>
</div>
</div><!-- /.sidebar-shortcuts -->

<ul class="nav nav-list">
<li class="">
<a href="index.html">
<i class="menu-icon fa fa-tachometer"></i>
<span class="menu-text"> 欢迎 </span>
</a>

<b class="arrow"></b>
</li>

<li class="active open">
<a href="#" class="dropdown-toggle">
<i class="menu-icon fa fa-list"></i>
<span class="menu-text"> 系统管理 </span>

<b class="arrow fa fa-angle-down"></b>
</a>

<b class="arrow"></b>

<ul class="submenu">
<li class="">
<a href="tables.html">
<i class="menu-icon fa fa-caret-right"></i>
用户管理
</a>

<b class="arrow"></b>
</li>

<li class="">
<a href="jqgrid.html">
<i class="menu-icon fa fa-caret-right"></i>
权限管理
</a>

<b class="arrow"></b>
</li>
</ul>
</li>

</ul><!-- /.nav-list -->

<div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
<i id="sidebar-toggle-icon" class="ace-icon fa fa-angle-double-left ace-save-state" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i>
</div>
</div>

<div class="main-content">
<div class="main-content-inner">
<div class="page-content">
<div class="row">
<div class="col-xs-12">
<!-- PAGE CONTENT BEGINS -->
<router-view/>
<!-- PAGE CONTENT ENDS -->
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->

<div class="footer">
<div class="footer-inner">
<div class="footer-content">
<span class="bigger-120">
<span class="blue bolder">甲蛙</span>
在线视频课程 &copy; 2099-2099
</span>

&nbsp; &nbsp;
<span class="action-buttons">
<a href="#">
<i class="ace-icon fa fa-twitter-square light-blue bigger-150"></i>
</a>

<a href="#">
<i class="ace-icon fa fa-facebook-square text-primary bigger-150"></i>
</a>

<a href="#">
<i class="ace-icon fa fa-rss-square orange bigger-150"></i>
</a>
</span>
</div>
</div>
</div>

<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
<i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
</a>
</div><!-- /.main-container -->
</div>
</template>

<script>


export default {
name: "admin",
mounted: function() {
$("body").removeClass("login-layout light-login");
$("body").attr("class", "no-skin");
// console.log("admin");
},
methods: {
login () {
this.$router.push("/admin")
}
}
}
</script>
  1. 增加js依赖,解决navbar中,三个菜单的点击弹窗效果。js从ace/index.html复制
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta charset="utf-8" />
    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
    <title>Login Page - Ace Admin</title>

    <meta name="description" content="User login page" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

    <!-- bootstrap & fontawesome -->
    <link rel="stylesheet" href="<%= BASE_URL %>ace/assets/css/bootstrap.min.css" />
    <link rel="stylesheet" href="<%= BASE_URL %>ace/assets/font-awesome/4.5.0/css/font-awesome.min.css" />

    <!-- text fonts -->
    <link rel="stylesheet" href="<%= BASE_URL %>ace/assets/css/fonts.googleapis.com.css" />

    <!-- ace styles -->
    <link rel="stylesheet" href="<%= BASE_URL %>ace/assets/css/ace.min.css" />

    <!--[if lte IE 9]>
    <link rel="stylesheet" href="<%= BASE_URL %>ace/assets/css/ace-part2.min.css" />
    <![endif]-->
    <link rel="stylesheet" href="<%= BASE_URL %>ace/assets/css/ace-rtl.min.css" />

    <!--[if lte IE 9]>
    <link rel="stylesheet" href="<%= BASE_URL %>ace/assets/css/ace-ie.min.css" />
    <![endif]-->

    <!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->

    <!--[if lte IE 8]>
    <script src="<%= BASE_URL %>ace/assets/js/html5shiv.min.js"></script>
    <script src="<%= BASE_URL %>ace/assets/js/respond.min.js"></script>
    <![endif]-->

    <!--[if !IE]> -->
    <script src="<%= BASE_URL %>ace/assets/js/jquery-2.1.4.min.js"></script>

    <!-- <![endif]-->

    <!--[if IE]>
    <script src="<%= BASE_URL %>ace/assets/js/jquery-1.11.3.min.js"></script>
    <![endif]-->
    <script type="text/javascript">
    if('ontouchstart' in document.documentElement) document.write("<script src='assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
    </script>
    <script src="<%= BASE_URL %>ace/assets/js/bootstrap.min.js"></script>

    <!-- page specific plugin scripts -->

    <!--[if lte IE 8]>
    <script src="<%= BASE_URL %>ace/assets/js/excanvas.min.js"></script>
    <![endif]-->
    <script src="<%= BASE_URL %>ace/assets/js/jquery-ui.custom.min.js"></script>
    <script src="<%= BASE_URL %>ace/assets/js/jquery.ui.touch-punch.min.js"></script>
    <script src="<%= BASE_URL %>ace/assets/js/jquery.easypiechart.min.js"></script>
    <script src="<%= BASE_URL %>ace/assets/js/jquery.sparkline.index.min.js"></script>
    <script src="<%= BASE_URL %>ace/assets/js/jquery.flot.min.js"></script>
    <script src="<%= BASE_URL %>ace/assets/js/jquery.flot.pie.min.js"></script>
    <script src="<%= BASE_URL %>ace/assets/js/jquery.flot.resize.min.js"></script>

    <!-- ace scripts -->
    <script src="<%= BASE_URL %>ace/assets/js/ace-elements.min.js"></script>
    <script src="<%= BASE_URL %>ace/assets/js/ace.min.js"></script>

    </head>
    <body>
    <noscript>
    <strong>We're sorry but admin 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>