Skip to content

Commit

Permalink
docs: suggest to always set title prop (close #87)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorlxy committed Apr 9, 2020
1 parent 33acae3 commit 9723b2d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/docs/src/options/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ Vssue component props are set when using `<Vssue />` component:
- If the type is `string`, the actual title of issue is `` `${prefix}${title}` ``.
- If the type is `Function`, the actual title of issue is the return value of the function. Notice that the first parameter of the function is the options of Vssue, and you can use them to generate the actual title.

::: tip
Although `title` has its default value, it's suggested to always set `title` explicitly in SPA, or Vue.js may always use the same Vssue component instance when navigating between different SPA pages. Alternatively, you can add [key](https://vuejs.org/v2/api/#key) to help Vue.js identify the components.
:::

::: warning ATTENTION
When trying to load comments, Vssue will request the corresponding issue according to `labels` and `title`. If the issue does not exist, Vssue will try to create a new issue with `title`, `issueContent` and `labels`.

Expand Down
4 changes: 4 additions & 0 deletions packages/docs/src/zh/options/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ Vssue 组件 Props 是在使用 `<Vssue />` 组件时设置的:
- 如果类型是 `string`,实际标题是 `` `${prefix}${title}` ``
- 如果类型是 `Function`,实际标题是函数的返回值。注意,这个函数的第一个参数是 Vssue 的 options,你可以通过它们来生成实际的标题。

::: tip 提示
虽然 `title` 有默认值,但是我们建议你在 SPA 中明确设置 `title` 的值,否则在 SPA 的不同页面间切换时,Vue.js 可能会只使用同一个 Vssue 组件实例。当然,你也可以使用 [key](https://cn.vuejs.org/v2/api/#key) 来帮助 Vue.js 辨识组件。
:::

::: warning 注意
Vssue 在尝试加载评论时,将会根据 `labels``title` 来请求对应的 Issue。如果这个 Issue 不存在,将会使用 `title``issueContent``labels` 来创建一个新的 Issue。

Expand Down

0 comments on commit 9723b2d

Please sign in to comment.