webpack vue

Loaders
cnpm install vue-loader@14 vue-template-compiler --save-dev

webpack.config.js

module: {
  rules: [{
    test: /\.vue$/,
    use: ['vue-loader']
  }],
},

App.vue

<template>
  <div id="">
    <p>{{message}}</p>
    <p>Hello furong!</p>
  </div>
</template>

<script>
  export default {
    name: 'App',
    data() {
      return {
        message: 'Hello Vue.js!',
      }
    },
    methods: {

    }
  }
</script>

<style>
</style>

vue.js

import Vue from "vue";
import App from './App.vue';

new Vue({
  el: '#app',
  template: '<App/>',
  components: {
    App
  },
  methods: {

  }
})
posted @ 2021-07-07 16:44  thomas_blog  阅读(32)  评论(0编辑  收藏  举报