🌐 AI搜索 & 代理 主页
Skip to content

Commit 5c87819

Browse files
authored
Update README.md
1 parent 8c2a68b commit 5c87819

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/components/nav/README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,13 @@ Use `<b-nav-item-dropdown>` to place dropdown items within your nav.
190190

191191
Sometimes you want to add your own class names to the generated dropdown toggle button, that by
192192
default have the classes `nav-link` and `dropdown-toggle`. Use the `toggle-class` prop to add them
193-
(like above) which will produce something like:
193+
(like above) which will render HTML similar to:
194194

195195
```html
196196
<li id="my-nav-dropdown" class="nav-item b-nav-dropdown dropdown">
197197
<a
198-
href="#"
198+
role="button"
199+
href="#my-nav-dropdown"
199200
id="my-nav-dropdown__BV_button_"
200201
aria-haspopup="true"
201202
aria-expanded="false"
@@ -222,6 +223,17 @@ shown. When there are a large number of dropdowns rendered on the same page, per
222223
impacted due to larger overall memory utilization. You can instruct `<b-nav-item-dropdown>` to
223224
render the menu contents only when it is shown by setting the `lazy` prop to true.
224225

226+
### Dropdown implementation note
227+
228+
Note that the toggle button is actually rendered as a link `<a>` tag with `role="button"` for
229+
styling purposes, and typically has the `href` set to `#` unless and ID is provided via the `id`
230+
prop.
231+
232+
The toggle will prevent scroll top top behaviour (via javascript) when clicking the toggle link. In
233+
some cases when using SSR, and the user clicks the toggle button _before_ Vue has had a chance to
234+
hydrate the component, the page will scroll to top. In these cases, simply providing a unique ID
235+
via the `id` prop will prevent the unwanted scroll to top behaviour.
236+
225237
## Nav text content
226238

227239
Use the `<b-nav-text>` child component to place plain text content into the nav:

0 commit comments

Comments
 (0)