工作笔记

4. 组件component

2019-06-11  本文已影响0人  论宅

一个基本的组件结构如下:

<template>
  <div class="hello">
    <a href="./#/FangJun">点我</a>
    <h1>{{ msg }}</h1>
  </div>
</template>

<script>
export default {
  name: "HelloWorld",
  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;
}

</style>

有三部分组成:
template:存放html代码
script:存放脚本代码
style:存放css代码

上一篇 下一篇

猜你喜欢

热点阅读