From 142371ea3e9a1db3efbfdefa52899596d9c4f9a1 Mon Sep 17 00:00:00 2001 From: 07akioni <07akioni2@gmail.com> Date: Tue, 4 Feb 2020 12:40:06 +0800 Subject: [PATCH] doc(anchor): zh-cn --- .../components/anchor/enUS/index.md | 10 +++--- .../components/anchor/zhCN/affix.md | 14 +++++++++ .../components/anchor/zhCN/basic.md | 13 ++++++++ .../components/anchor/zhCN/index.md | 20 ++++++++++++ .../components/anchor/zhCN/scrollto.md | 31 +++++++++++++++++++ 5 files changed, 83 insertions(+), 5 deletions(-) create mode 100644 demo/documentation/components/anchor/zhCN/affix.md create mode 100644 demo/documentation/components/anchor/zhCN/basic.md create mode 100644 demo/documentation/components/anchor/zhCN/scrollto.md diff --git a/demo/documentation/components/anchor/enUS/index.md b/demo/documentation/components/anchor/enUS/index.md index b1401c3b8..02c8f9555 100644 --- a/demo/documentation/components/anchor/enUS/index.md +++ b/demo/documentation/components/anchor/enUS/index.md @@ -1,6 +1,6 @@ # Anchor -The demo used to use some charactor names from *Hard-Boiled Wonderland and the End of the World* as anchor links, but if so there will be too wired in this page. So I rewrite them. What a pity. +These demos used to use some charactor names from *Hard-Boiled Wonderland and the End of the World* as anchor links, but if so there will be too wired in this page compared with other pages. So I rewrite them. What a pity. ## Demos ```demo basic @@ -11,10 +11,10 @@ scrollto |Name|Type|Default|Description| |-|-|-|-| |affix|`boolean`|`false`|If it works like a affix. If set to `true`, it will recieve props from [affix](n-affix#Props)| -|target|`() => HTMLElement`|A function that returns the nearest scrollable ascendant element|The element that anchor listens to scroll event.| +|target|`() => HTMLElement`|A function that returns the nearest scrollable ascendant element|The element that anchor listens to scroll event. (If you want affix & anchor to listen to different target, manually warp anchor in affix instead.)| |bound|`number`|`12`|| ## Methods -|Method|Description| -|-|-| -|`scrollTo(href: string)`|| \ No newline at end of file +|Name|Type|Description| +|-|-|-| +|scrollTo|`(href: string): void`|| \ No newline at end of file diff --git a/demo/documentation/components/anchor/zhCN/affix.md b/demo/documentation/components/anchor/zhCN/affix.md new file mode 100644 index 000000000..346df7148 --- /dev/null +++ b/demo/documentation/components/anchor/zhCN/affix.md @@ -0,0 +1,14 @@ +# 固定 +在固定模式下,Anchor 还接受和 Affix 一样的 Props。 +```html +
+ + + + + + + + +
+``` \ No newline at end of file diff --git a/demo/documentation/components/anchor/zhCN/basic.md b/demo/documentation/components/anchor/zhCN/basic.md new file mode 100644 index 000000000..cdb81d826 --- /dev/null +++ b/demo/documentation/components/anchor/zhCN/basic.md @@ -0,0 +1,13 @@ +# 基础用法 +```html +
+ + + + + + + + +
+``` \ No newline at end of file diff --git a/demo/documentation/components/anchor/zhCN/index.md b/demo/documentation/components/anchor/zhCN/index.md index e69de29bb..2c398489e 100644 --- a/demo/documentation/components/anchor/zhCN/index.md +++ b/demo/documentation/components/anchor/zhCN/index.md @@ -0,0 +1,20 @@ +# 页面导航 Anchor + +下面的演示曾经用的是《世界尽头与冷酷仙境》的一些角色名称作为 Anchor 的子标题,但是这样的话和其他页面差的就有点远了。所以最后还是重写了这个页面,表示遗憾。 +## 演示 +```demo +basic +affix +scrollto +``` +## Props +|名称|类型|默认值|介绍| +|-|-|-|-| +|affix|`boolean`|`false`|Anchor 是否像 Affix 一样展示,如果设定为 `true`,它还会接受 [Affix](n-affix#Props) 的 Props| +|target|`() => HTMLElement`|一个返回最邻近可滚动祖先元素的函数|需要监听滚动的元素(如果你希望 Anchor 和 Affix 分别监听不同的元素,可以手动的组合 Anchor 和 Affix)| +|bound|`number`|`12`|| + +## Methods +|名称|类型|介绍| +|-|-|-| +|scrollTo|`(href: string): void`|| \ No newline at end of file diff --git a/demo/documentation/components/anchor/zhCN/scrollto.md b/demo/documentation/components/anchor/zhCN/scrollto.md new file mode 100644 index 000000000..367bcc5c8 --- /dev/null +++ b/demo/documentation/components/anchor/zhCN/scrollto.md @@ -0,0 +1,31 @@ +# 滚动到 +```html +
+ + + + + + + + +
+
+ 基础用法 + 固定 +
+``` +```js +export default { + methods: { + scrollTo (href) { + this.$refs.anchor.scrollTo(href) + } + } +} +``` +```css +.n-button { + margin: 0 8px 12px 0; +} +```