Skip to content

Commit a4398ae

Browse files
committed
Getting started with Vue.js
1 parent 4f6a266 commit a4398ae

File tree

6 files changed

+103
-0
lines changed

6 files changed

+103
-0
lines changed

getting-started-with-vuejs/App.vue

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<template>
2+
<div>
3+
<BearList :bears="bears" @click="growl" />
4+
<BearList :bears="bears" />
5+
<button @click="addBear">Add Bear</button>
6+
</div>
7+
</template>
8+
9+
<script>
10+
const BearList = require('./BearList.vue')
11+
module.exports = {
12+
data: function () {
13+
return {
14+
bears: [
15+
'grizzly',
16+
'polar',
17+
'brown'
18+
]
19+
}
20+
},
21+
methods: {
22+
addBear: function () {
23+
this.bears.push('New Bear')
24+
},
25+
growl: function (msg, e) {
26+
console.log(msg, e)
27+
}
28+
},
29+
components: {
30+
BearList: BearList
31+
}
32+
}
33+
</script>
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<ul>
3+
<li v-for="bear in bears" @click="click(bear, $event)">
4+
{{bear}}
5+
</li>
6+
</ul>
7+
</template>
8+
9+
<script>
10+
module.exports = {
11+
props: ['bears'],
12+
methods: {
13+
click: function (bear, e) {
14+
const msg = bear + ' has growled.'
15+
this.$emit('click', msg, e)
16+
}
17+
}
18+
}
19+
</script>

getting-started-with-vuejs/README.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Getting Started with Vue.js
2+
3+
> [https://www.youtube.com/watch?v=iFqWU1dxm8U](https://www.youtube.com/watch?v=iFqWU1dxm8U)
4+
5+
Install [Node.js](https://nodejs.org/).
6+
7+
Within this folder run the terminal command `npm install` to install the
8+
`dependencies` and `devDependencies`.
9+
10+
Then run `npm start` to run the app viewable on `http://localhost:9966`.

getting-started-with-vuejs/index.html

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Document</title>
6+
</head>
7+
<body>
8+
<div id="app"></div>
9+
<script src="bundle.js" charset="utf-8"></script>
10+
</body>
11+
</html>

getting-started-with-vuejs/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const Vue = require('vue')
2+
const App = require('./App.vue')
3+
new Vue({
4+
el: '#app',
5+
render: function (h) {
6+
return h(App)
7+
}
8+
})
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "getting-started-with-vuejs",
3+
"version": "0.1.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"start": "budo index.js:bundle.js -- -t vueify",
8+
"test": "node test.js"
9+
},
10+
"browser": {
11+
"vue": "vue/dist/vue.common.js"
12+
},
13+
"author": "Kyle Robinson Young <[email protected]> (http://dontkry.com)",
14+
"license": "MIT",
15+
"devDependencies": {
16+
"budo": "^11.2.0",
17+
"vueify": "^9.4.1"
18+
},
19+
"dependencies": {
20+
"vue.js": "^0.3.2"
21+
}
22+
}

0 commit comments

Comments
 (0)