From 1606928b8ca39f99381039f0f4bdd355f12ea8f4 Mon Sep 17 00:00:00 2001 From: NataliaTepluhina Date: Sun, 26 Jul 2020 17:49:50 +0300 Subject: [PATCH 1/2] chore: replaced first example in Introduction --- src/.vuepress/components/FirstExample.vue | 31 +++++++++++++++++++++ src/guide/introduction.md | 34 +++++++++++++++-------- 2 files changed, 53 insertions(+), 12 deletions(-) create mode 100644 src/.vuepress/components/FirstExample.vue diff --git a/src/.vuepress/components/FirstExample.vue b/src/.vuepress/components/FirstExample.vue new file mode 100644 index 0000000000..6b1101b461 --- /dev/null +++ b/src/.vuepress/components/FirstExample.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/src/guide/introduction.md b/src/guide/introduction.md index 301eb4640c..b5581fc363 100644 --- a/src/guide/introduction.md +++ b/src/guide/introduction.md @@ -29,31 +29,41 @@ The [Installation](installation.md) page provides more options of installing Vue At the core of Vue.js is a system that enables us to declaratively render data to the DOM using straightforward template syntax: ```html -
- {{ message }} +
+ Counter: {{ counter }}
``` ```js -const HelloVueApp = { +const CounterApp = { data() { return { - message: 'Hello Vue!' + counter: 0 } } } -Vue.createApp(HelloVueApp).mount('#hello-vue') +Vue.createApp(CounterApp).mount('#counter') ``` -We have already created our very first Vue app! This looks pretty similar to rendering a string template, but Vue has done a lot of work under the hood. The data and the DOM are now linked, and everything is now **reactive**. How do we know? Change the `message` property in the code snippet below to a different value and the rendered example will update accordingly: +We have already created our very first Vue app! This looks pretty similar to rendering a string template, but Vue has done a lot of work under the hood. The data and the DOM are now linked, and everything is now **reactive**. How do we know? Take a look at the example below where `counter` property increments every second and you will see how rendered DOM changes: -

- See the Pen - Hello Vue by Vue (@Vue) - on CodePen. -

- +```js{8-10} +const CounterApp = { + data() { + return { + counter: 0 + } + }, + mounted() { + setInterval(() => { + this.counter++ + }, 1000) + } +} +``` + + In addition to text interpolation, we can also bind element attributes like this: From ff1d622d38d36ac6a39c3db461ca1fc108d0dc4d Mon Sep 17 00:00:00 2001 From: NataliaTepluhina Date: Tue, 28 Jul 2020 17:34:10 +0300 Subject: [PATCH 2/2] fix: added button to stop interval --- src/.vuepress/components/FirstExample.vue | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/.vuepress/components/FirstExample.vue b/src/.vuepress/components/FirstExample.vue index 6b1101b461..86a9209ed1 100644 --- a/src/.vuepress/components/FirstExample.vue +++ b/src/.vuepress/components/FirstExample.vue @@ -1,16 +1,25 @@