来源: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>
时间: 2024-10-27 12:54:29