mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-18 12:34:25 +08:00
doc(anchor)
This commit is contained in:
parent
a46b5d3dfd
commit
09c3b8d73f
@ -2,14 +2,13 @@
|
||||
When in affix mode, Anchor can recieve addition props as same as Affix.
|
||||
```html
|
||||
<div style="height: 200px;">
|
||||
<n-anchor affix :offset-top="24" :top="88" style="z-index: 1;">
|
||||
<n-anchor-link title="The Narrator" href="#the-narrator"/>
|
||||
<n-anchor-link title="The Narrator's Shadow" href="#the-narrator-s-shadow"/>
|
||||
<n-anchor-link title="The Gatekeeper" href="#the-gatekeeper"/>
|
||||
<n-anchor-link title="The Librarian" href="#the-librarian">
|
||||
<n-anchor-link title="The Colonel" href="#the-colonel"/>
|
||||
<n-anchor-link title="The Caretaker" href="#the-caretaker"/>
|
||||
<n-anchor affix :offset-top="24" :top="88" style="z-index: 1;" :bound="24">
|
||||
<n-anchor-link title="Demos" href="#Demos">
|
||||
<n-anchor-link title="Basic" href="#basic"/>
|
||||
<n-anchor-link title="Affix" href="#affix"/>
|
||||
<n-anchor-link title="Scroll To" href="#scrollto"/>
|
||||
</n-anchor-link>
|
||||
<n-anchor-link title="Props" href="#Props" />
|
||||
</n-anchor>
|
||||
</div>
|
||||
```
|
@ -1,14 +1,13 @@
|
||||
# Basic
|
||||
```html
|
||||
<div style="height: 200px;">
|
||||
<div>
|
||||
<n-anchor>
|
||||
<n-anchor-link title="The Narrator" href="#the-narrator"/>
|
||||
<n-anchor-link title="The Narrator's Shadow" href="#the-narrator-s-shadow"/>
|
||||
<n-anchor-link title="The Gatekeeper" href="#the-gatekeeper"/>
|
||||
<n-anchor-link title="The Librarian" href="#the-librarian">
|
||||
<n-anchor-link title="The Colonel" href="#the-colonel"/>
|
||||
<n-anchor-link title="The Caretaker" href="#the-caretaker"/>
|
||||
<n-anchor-link title="Demos" href="#Demos">
|
||||
<n-anchor-link title="Basic" href="#basic"/>
|
||||
<n-anchor-link title="Affix" href="#affix"/>
|
||||
<n-anchor-link title="Scroll To" href="#scrollto"/>
|
||||
</n-anchor-link>
|
||||
<n-anchor-link title="Props" href="#Props" />
|
||||
</n-anchor>
|
||||
</div>
|
||||
```
|
@ -1,14 +1,20 @@
|
||||
# Anchor
|
||||
<!--single-column-->
|
||||
|
||||
## Demos
|
||||
```demo
|
||||
basic
|
||||
affix
|
||||
scrollto
|
||||
the-narrator
|
||||
the-narrator-s-shadow
|
||||
the-gatekeeper
|
||||
the-librarian
|
||||
the-colonel
|
||||
the-caretaker
|
||||
placeholder
|
||||
```
|
||||
```
|
||||
## Props
|
||||
|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.|
|
||||
|bound|`number`|`12`||
|
||||
|
||||
## Methods
|
||||
|Method|Description|
|
||||
|-|-|
|
||||
|`scrollTo(href: string)`||
|
@ -1,4 +0,0 @@
|
||||
# Placeholder
|
||||
```html
|
||||
<div style="height: 1200px;"></div>
|
||||
```
|
@ -1,19 +1,18 @@
|
||||
# Scroll To
|
||||
```html
|
||||
<div style="height: 200px; padding-left: 200px;">
|
||||
<n-anchor affix :offset-top="24" :top="88" style="z-index: 1;" ref="anchor">
|
||||
<n-anchor-link title="The Narrator" href="#the-narrator"/>
|
||||
<n-anchor-link title="The Narrator's Shadow" href="#the-narrator-s-shadow"/>
|
||||
<n-anchor-link title="The Gatekeeper" href="#the-gatekeeper"/>
|
||||
<n-anchor-link title="The Librarian" href="#the-librarian">
|
||||
<n-anchor-link title="The Colonel" href="#the-colonel"/>
|
||||
<n-anchor-link title="The Caretaker" href="#the-caretaker"/>
|
||||
<n-anchor affix :offset-top="24" :top="88" :bound="24" style="z-index: 1;" ref="anchor">
|
||||
<n-anchor-link title="Demos" href="#Demos">
|
||||
<n-anchor-link title="Basic" href="#basic"/>
|
||||
<n-anchor-link title="Affix" href="#affix"/>
|
||||
<n-anchor-link title="Scroll To" href="#scrollto"/>
|
||||
</n-anchor-link>
|
||||
<n-anchor-link title="Props" href="#Props" />
|
||||
</n-anchor>
|
||||
</div>
|
||||
<div style="padding-left: 400px;">
|
||||
<n-button @click="scrollTo('#the-librarian')">Librarian</n-button>
|
||||
<n-button @click="scrollTo('#the-caretaker')">Caretaker</n-button>
|
||||
<n-button @click="scrollTo('#basic')">Basic</n-button>
|
||||
<n-button @click="scrollTo('#affix')">Affix</n-button>
|
||||
</div>
|
||||
```
|
||||
```js
|
||||
|
@ -1,3 +0,0 @@
|
||||
# The Caretaker
|
||||
```html
|
||||
```
|
@ -1,3 +0,0 @@
|
||||
# The Colonel
|
||||
```html
|
||||
```
|
@ -1,3 +0,0 @@
|
||||
# The Gatekeeper
|
||||
```html
|
||||
```
|
@ -1,3 +0,0 @@
|
||||
# The Librarian
|
||||
```html
|
||||
```
|
@ -1,3 +0,0 @@
|
||||
# The Narrator
|
||||
```html
|
||||
```
|
@ -1,3 +0,0 @@
|
||||
# The Narrators's Shadow
|
||||
```html
|
||||
```
|
@ -39,7 +39,7 @@
|
||||
:value="lang"
|
||||
size="small"
|
||||
:options="langOptions"
|
||||
@input="handleLangInput"
|
||||
@change="handleLanguageChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@ -110,7 +110,7 @@ export default {
|
||||
handleThemeChange (theme) {
|
||||
this.NConfigProvider.$parent.theme = theme
|
||||
},
|
||||
handleLangInput (lang) {
|
||||
handleLanguageChange (lang) {
|
||||
this.$emit('lang-change', lang)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user