1、在components 目录下新建Test.vue 文件

<template>
<div class="test">
<h1>{{ msg }}</h1>
<router-link to="/login">跳转到详情页</router-link>
</div>
</template> <script>
export default {
name: 'test',
data () {
return {
msg: 'this.test uve'
}
}
}
</script> <!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
font-weight: normal;
} ul {
list-style-type: none;
padding: 0;
} li {
display: inline-block;
margin: 0 10px;
} a {
color: #42b983;
}
</style>

  

2、在Hell.vue里添加代码引用Test.vue

<template>
<div class="hello"> <h1>{{ msg }}</h1>
<!-- 引用的组件标签 和下边 import 的名称保持一致 -->
<test></test>
</div> </template> <script>
// 引用Test.vue 命名为test
import test from './Test'
export default {
name: 'hello',
// 引用组件
components:{
test
},
data () {
return {
msg: 'Welcome to Your Vue.js App'
}
}
}
</script> <!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
font-weight: normal;
} ul {
list-style-type: none;
padding: 0;
} li {
display: inline-block;
margin: 0 10px;
} a {
color: #42b983;
}
</style>

运行结果:  

最新文章

  1. SignalR快速入门 ~ 仿QQ即时聊天,消息推送,单聊,群聊,多群公聊(基础=》提升)
  2. java良好的编码习惯
  3. Hibernate的关联映射关系
  4. vim 分屏显示
  5. URL编码知识摘抄备忘
  6. 借助 SublimeLinter 编写高质量的 JavaScript &amp; CSS 代码
  7. [stm32] GPIO及最小框架
  8. P142-1
  9. Using FastCGI to Host PHP Applications on IIS 7 -IIS7 怎么配置 PHP5
  10. 用apache的httpclient发请求和接受数据
  11. FatMouse&amp;#39; Trade(杭电1009)
  12. hdu 1150 Machine Schedule(最小顶点覆盖)
  13. application19事件 20多少步骤 具体20多少只有微软知道!!!
  14. TemplateMethod-模板模式
  15. zTree基础
  16. python 容器类型数据 (str list tuple set dict)
  17. 指向函数的指针 ------ 函数指针(function pointer)
  18. Python3入门(十)——调试与测试
  19. [CF1062F]Upgrading Cities[拓扑排序]
  20. UI---------EventSystem

热门文章

  1. Swing项目编译成exe,并且打包成安装文件(一)
  2. C++之萃取技术(traits)
  3. Java原子属性更新器AtomicReferenceFieldUpdater的使用
  4. docker容器firewalld端口转发规则
  5. python -m json.tool 中文乱码 Format JSON with python
  6. Appleman and a Sheet of Paper
  7. Bean的基于注解的配置方式
  8. 第一篇:构建第一个SpringBoot工程
  9. sql语句之正则表达式
  10. python之文件的读写(1)