search

Home  >  Q&A  >  body text

javascript - vue reported an error. Yesterday I wrote the same thing and no error was reported, but today it reported an error. I don’t know the reason. Seek solution

mistake:

bundle.js:9657 [Vue warn]: Failed to mount component: template or render function not defined.

found in

---> <Anonymous>
       <Root>

index.js

var Vue = require( 'vue' ),
    Vpp = require( './vpp.vue' );
console.log( Vue );
new Vue.default( {
    el : '#vpp',
    render : function( h ) {
        return h( Vpp )
    }
} );

vpp.vue

<style>

</style>
<template>
    <p class="whole">
        <h1>123</h1>
    </p>
</template>
<script>
    module.explore = {
        data : function() {
            return {

            }
        }
    }
</script>

webpack.config.js

module.exports = {
  entry : {
      bundle : './src/index.js'
  },
    output : {
      path : __dirname + '/build',
        filename : '[name].js'
    },
    module : {
      rules : [
          {
              test : /\.vue$/g,
              use : {
                  loader : 'vue-loader'
              }
          }
      ]
    }
};

Yesterday I wrote the same thing and no error was reported, but today it was reported an error. I don’t know the reason. Seek solution.

習慣沉默習慣沉默2697 days ago951

reply all(1)I'll reply

  • 巴扎黑

    巴扎黑2017-07-05 10:48:51

    It would be fine if I changed it to es6, but I don’t know why it was fine yesterday

    reply
    0
  • Cancelreply