codecamp

Parcel 与 Vue

Vue

支持扩展类型: vue

Vue.js 是一个渐进式、增量采用、在 web 环境构建用户界面的 JavaScript 框架。Parcel 对 Vue 支持是开箱即用的。

<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Parcel - Vue</title>
  </head>
  <body>
    <div id="app"></div>
    <script src="./index.js"></script>
  </body>
</html>

使用你喜爱的工具(例如:Pug, TypeScript, SCSS, ...):

// app.vue
<template lang="pug">
  .container Hello {{bundler}}
</template>

<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
  data() {
    return {
      bundler: 'Parcel'
    }
  }
})
</script>

<style lang="scss" scoped>
.container {
  color: green;
}
</style>
// index.js
import Vue from 'vue'
import App from './app.vue'

new Vue({
  el: '#app',
  render: h => h(App)
})


Parcel 与 CoffeeScript
Parcel 与 JSON
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }