Skip to content

Commit 0203dfa

Browse files
robin-macphersonPeachScript
authored andcommitted
docs: update hacker news guide (#217)
1 parent bdb23f0 commit 0203dfa

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/guide/start-with-hn.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ previewLink: //jsfiddle.net/PeachScript/a4Lxbf9w/embedded/result/
44

55
# Start With Hacker News
66

7-
As the first step in learning this plugin, we will create a infinite scroll version of the [Hacker News](https://news.ycombinator.com/).
7+
As the first step in learning how to use this plugin, we will create an infinite scrolling version of [Hacker News](https://news.ycombinator.com/).
88

9-
Firstly, we need to write template, it similar to this (ommited unimportant code):
9+
Firstly, we need to write a template, which is similar to this (ommited unimportant code):
1010

1111
``` html {9}
1212
<header>
@@ -20,9 +20,9 @@ Firstly, we need to write template, it similar to this (ommited unimportant code
2020
<infinite-loading @infinite="infiniteHandler"></infinite-loading>
2121
```
2222

23-
In the template, we put the `InfiniteLoading` component at the bottom of news list, and listen it's `infinite` event by a method called `infiniteHandler`.
23+
In the template, we put the `InfiniteLoading` component at the bottom of the news list, and listen for it's `infinite` event with a method called `infiniteHandler`.
2424

25-
Then write the core logic, `infiniteHandler` method:
25+
Then, we write the core logic for the `infiniteHandler` method:
2626

2727
``` js
2828
import axios from 'axios';
@@ -56,6 +56,6 @@ export default {
5656
};
5757
```
5858

59-
In the script, we use [HN Search API](https://hn.algolia.com/api) and [axios](https://github.com/mzabriskie/axios) to fetch news data. If the server API returns an array with news data, we will push them into `list`, record current page, and tell this plugin through `$state.loaded` method that we got some data. If the server API returns an empty array, we will tell this plugin through `$state.complete` method that all data has been loaded.
59+
In the script, we use [HN Search API](https://hn.algolia.com/api) and [axios](https://github.com/mzabriskie/axios) to fetch the news data. If the server API returns an array with the news data, we will push it into `list`, record the current page, and tell this plugin through the `$state.loaded` method that we got some data. If the server API returns an empty array, we will tell this plugin through `$state.complete` method that all data has been loaded.
6060

6161
Now, you can get an infinite scroll version of Hacker News, just like the preview on the right.

0 commit comments

Comments
 (0)