简体   繁体   中英

Vue.js component white screen

I got a white screen in my simple demo component and I have not any idea what is wrong with my code.

Dashboard.vue

<template>
  <div id="app">
    <h1>{{ msg }}</h1>
  </div>
</template>

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

main.js

import Vue from 'vue'
import Dashboard from './components/Dashboard.vue'
new Vue({
    el: '#app',
    components : {
        Dashboard
    }
}) 

Just white screen, components are not present in DOM. Vue2.X

Place this in your main.js , there's no render function in yours:

import Vue from "vue";
import Dashboard from "./components/Dashboard.vue";

Vue.config.productionTip = false;

new Vue({
  render: h => h(Dashboard)
}).$mount("#app");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM