首页 > 其他 > 详细

vue组件三种书写方式

时间:2017-07-11 18:53:14      阅读:329      评论:0      收藏:0      [点我收藏+]

来源:http://blog.csdn.net/u012123026/article/details/72460470

第三种方式:

Hello.vue

<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
  </div>
</template>

<script>
export default {
  name: ‘hello‘,
  data () {
    return {
      msg: ‘欢迎!‘
    }
  }
}
</script>

  app.vue

<!-- 展示模板 -->
<template>
  <div id="app">
    <img src="./assets/logo.png">
    <hello></hello>
  </div>
</template>

<script>
// 导入组件
import Hello from ‘./components/Hello‘

export default {
  name: ‘app‘,
  components: {
    Hello
  }
}
</script>
<!-- 样式代码 -->
<style>
#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>

  

vue组件三种书写方式

原文:http://www.cnblogs.com/dontes/p/7151968.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!