Skip to content

Commit f07834b

Browse files
authored
Merge pull request #7 from vuejs/move-introduction
Refactored Introduction to Vue 3 syntax
2 parents 2f3414d + 1dc4be7 commit f07834b

File tree

11 files changed

+403
-4
lines changed

11 files changed

+403
-4
lines changed

src/.vuepress/components/intro-1.vue

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<template>
2+
<div id="app" class="demo">
3+
{{ message }}
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
data() {
10+
return {
11+
message: 'Hello Vue!'
12+
}
13+
},
14+
}
15+
</script>

src/.vuepress/components/intro-2.vue

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<template>
2+
<div id="app-2" class="demo">
3+
<span v-bind:title="message">
4+
Hover your mouse over me for a few seconds to see my dynamically bound title!
5+
</span>
6+
</div>
7+
</template>
8+
9+
<script>
10+
export default {
11+
data() {
12+
return {
13+
message: 'You loaded this page on ' + new Date().toLocaleString()
14+
}
15+
},
16+
}
17+
</script>

src/.vuepress/components/intro-3.vue

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<template>
2+
<div id="app-3" class="demo">
3+
<span v-if="seen">Now you see me</span>
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
data() {
10+
return {
11+
seen: true
12+
}
13+
},
14+
}
15+
</script>

src/.vuepress/components/intro-4.vue

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<template>
2+
<div id="app-4" class="demo">
3+
<ol>
4+
<li v-for="todo in todos">
5+
{{ todo.text }}
6+
</li>
7+
</ol>
8+
</div>
9+
</template>
10+
11+
<script>
12+
export default {
13+
data() {
14+
return {
15+
todos: [
16+
{ text: 'Learn JavaScript' },
17+
{ text: 'Learn Vue' },
18+
{ text: 'Build something awesome' }
19+
]
20+
}
21+
},
22+
}
23+
</script>

src/.vuepress/components/intro-5.vue

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<template>
2+
<div id="app-5" class="demo">
3+
<p>{{ message }}</p>
4+
<button v-on:click="reverseMessage">Reverse Message</button>
5+
</div>
6+
</template>
7+
8+
<script>
9+
export default {
10+
data() {
11+
return {
12+
message: 'Hello Vue.js!'
13+
}
14+
},
15+
methods: {
16+
reverseMessage: function () {
17+
this.message = this.message.split('').reverse().join('')
18+
}
19+
}
20+
}
21+
</script>

src/.vuepress/components/intro-6.vue

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<template>
2+
<div id="app-6" class="demo">
3+
<p>{{ message }}</p>
4+
<input v-model="message">
5+
</div>
6+
</template>
7+
8+
<script>
9+
export default {
10+
data() {
11+
return {
12+
message: 'Hello Vue!'
13+
}
14+
},
15+
}
16+
</script>

src/.vuepress/components/intro-7.vue

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<template>
2+
<div id="app-7" class="demo">
3+
<ol>
4+
<todo-item v-for="item in groceryList" v-bind:todo="item" :key="item.id"></todo-item>
5+
</ol>
6+
</div>
7+
</template>
8+
9+
<script>
10+
import Vue from 'vue/dist/vue.js'
11+
export default {
12+
data() {
13+
return {
14+
groceryList: [
15+
{ id: 0, text: 'Vegetables' },
16+
{ id: 1, text: 'Cheese' },
17+
{ id: 2, text: 'Whatever else humans are supposed to eat' }
18+
]
19+
}
20+
},
21+
components: {
22+
'todo-item': Vue.component('todo-item', {
23+
props: ['todo'],
24+
template: '<li>{{ todo.text }}</li>'
25+
})
26+
}
27+
}
28+
</script>
6.06 KB
Loading

src/.vuepress/styles/index.styl

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.theme-default-content:not(.custom) {
2+
max-width 960px
3+
}
4+
5+
.demo {
6+
font-family: sans-serif;
7+
border: 1px solid #eee;
8+
border-radius: 2px;
9+
padding: 20px 30px;
10+
margin-top: 1em;
11+
margin-bottom: 40px;
12+
user-select: none;
13+
overflow-x: auto;
14+
}

src/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ heroImage: /logo.png
44
heroText: Vue.js
55
tagline: The Progressive JavaScript Framework
66
actionText: Get Started →
7-
actionLink: /docs/
7+
actionLink: /guide/introduction
88
features:
99
- title: Approachable
1010
details: Already know HTML, CSS and JavaScript? Read the guide and start building things in no time!

0 commit comments

Comments
 (0)