Up & Running
Vue.js
Sócio-diretor na Formaweb
caio@yahoo.com
Ou seja, nada de arquivo de configuração.
Rápido, leve e sem configuração.
$ yarn global add parcel-bundler
$ mkdir example
$ cd example
$ yarn init -y
$ npm install -g parcel-bundler
$ mkdir example
$ cd example
$ npm init -y
Seguiremos com o Yarn, ok? ;)
$ yarn add vue
$ yarn add --dev parcel-bundler
{
"name": "Example",
"version": "1.0.0",
"main": "index.js",
"private": true,
"scripts": {
"start": "parcel public/index.html"
},
"dependencies": {
"vue": "^2.5.16"
}
}
package.json
$ yarn install
$ yarn start
public/
index.html
src/
assets/
icon.svg
components/
button.vue
pages/
product-list.vue
product-detail.vue
styles/
style.css
App.vue
main.js
package.json
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello Vue!</title>
</head>
<body>
<div id="app"></div>
<script src="../src/index.js"></script>
</body>
</html>
import Vue from 'vue'
import App from './App'
new Vue({
el: '#app',
router,
render: h => h(App)
})
<template>
<div>
Hello,{{ what }}!
</div>
</template>
<script>
export default {
data () {
return {
what: 'world'
}
}
}
</script>
<style>
div {
color: red;
}
</style>
Colocando a mão na massa!
Obrigado!
caio@yahoo.com