参考
webpack
使用hbuilder
创建

首页

定义组件
Home.vue
<template>
<div>
<h1> Home.vue组件 通过 <zsz> </zsz> 包含 Test.vue组件 </h1>
<zsz></zsz>
<hr/>
<h1>Hello App! 本页面继续路由</h1>
<p>
<router-link to="/foo">Go to Foo</router-link>
<router-link to="/bar">Go to Bar</router-link>
</p>
<router-view></router-view>
</div>
</template>
Form.vue
<template>
<div>
<form role="form">
<div class="form-group">
<label for="name">名称</label>
<input type="text" class="form-control" id="name"
placeholder="请输入名称">
</div>
<div class="form-group">
<label for="inputfile">文件输入</label>
<input type="file" id="inputfile">
<p class="help-block">这里是块级帮助文本的实例。</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox"> 请打勾
</label>
</div>
<button type="submit" class="btn btn-default">提交</button>
</form>
</div>
</template>
Table.vue
<template>
<div>
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>Firstname</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Anna</td>
</tr>
<tr>
<td>2</td>
<td>Debbie</td>
</tr>
<tr>
<td>3</td>
<td>John</td>
</tr>
</tbody>
</table>
</div>
</template>
使用
定义首页
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>singlevue</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div id="app" class="container">
<div class="row clearfix">
<div class="col-md-2 column">
<ul class="nav nav-pills nav-stacked">
<li class="active" name='home'> <a href="#/home" onclick='makeactive("home")'>XX功能</a></li>
<li name="test"><router-link to="/table" onclick='makeactive("test")'>table功能</router-link></li>
<li name="bar"><router-link to="/bar" onclick='makeactive("bar")'>inner组件</router-link></li>
</ul>
</div>
<div class="col-md-10 column">
<router-view />
</div>
</div>
</div>
</body>
<script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
<script src="https://cdn.staticfile.org/vue-router/2.7.0/vue-router.min.js"></script>
<script src="https://unpkg.com/http-vue-loader"></script>
<script src="router.js"></script>
</html>
定义路由

效果
IDE浏览

tomcat
