parcel-vue

2018-10-16  本文已影响89人  午夜阳光5021

使用parcel + vue的项目简单介绍

介绍

Parcel

手动搭建

mkdir vue-parcel
cd vue-parcel //进入项目目录
npm init -y //初始化
npm install --save vue // 安装vue
npm install --save-dev parcel-bundler // 安装parcel
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Vue Parcel Example</title>
</head>
<body>
  <div id="app">
  </div>

  <script src="src/main.js"></script>
</body>
</html>
import Vue from 'vue';
import App from './App.vue';

new Vue({
  render: h => h(App)
}).$mount('#app')
<template>
  <div id="app">
    <HelloWorld />
  </div>
</template>

<script>
import HelloWorld from './components/HelloWorld';

export default {
  components: {
    HelloWorld
  }
}
</script>

HelloWorld.vue

<template>
  <div class="hello-world">
    <h1>Hello World!</h1>
  </div>
</template>

<script>
export default {
  name: 'hello-world',
}
</script>
"scripts": {
    "start": "parcel index.html",
    "build": "parcel build index.html"
  },

快速构建

上一篇 下一篇

猜你喜欢

热点阅读