VUE这个子组件为什么显示不出来?

为什么访问http://localhost:8080/的时候显示不出来这个Test.vue里面的东西呢?
图片描述

App.vue里面的代码

<template>
  <div id="app">
    <Test></Test>
  </div>
</template>

<script>
import Test from '@/components/Test'

export default {
}
</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>

Test.vue的代码

<template>
 <div>
  <button class="btn">{{msg}}</button>
 </div>
</template>

<script>
export default {
  name: 'Test',
  data () {
    return {
      msg: 'test'
    }
  }
}
</script>

<style scoped>
 .btn{background-color:blue;}
</style>
阅读 4.9k
1 个回答

App.vue 中

export default {
    components: { Test }
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题