一个基本的组件结构如下:
<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代码