-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: router link components improvements (#1651)
* fix(MdTab): exact router fix exact router for active class fix #1644 * fix(MdList): non-exact router active style keep non-exact list item active when matched * fix(MdBottomBar router): elegant router with active class better router active with class instead of comparing `to` prop * fix(MdTabs): elegant router with active class better router active with class instead of comparing `to` prop * fix(MdBottomBar): fix bugs prevent active bar item directly in sync route mode * docs(WithRouter): discriptions about working with vue router * fix(MdTabs): better setIndicatorStyles performance with throttling * fix(MdTabs): fix bugs * docs(TabRouter): Better example Remove tabs in tabs because that's a bad idea * docs(TabRouter): remove unused codes * feat(MdSteppers): elegant router with active class better router active with class instead of comparing `to` prop * docs(WithRouter): add md-step * feat(MdStep): support all router-link props * refactor(MdThrottling): reduce duplicated code for getting options * fix(MdThrottling): typo * fix(routes): doc production mapRoutes method replace string * refactor(MdButton): lint complexity
- Loading branch information
Showing
21 changed files
with
280 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<template> | ||
<page-container centered :title="$t('pages.withRouter.title')"> | ||
<div class="page-container-section"> | ||
<h2 class="md-headline">Vue Material Router Link Components</h2> | ||
<p>Vue router supported with <code><router-link to="/components/tabs">md-tab</router-link></code>, <code><router-link to="/components/list">md-list-item</router-link></code>, <code><router-link to="/components/bottom-bar">md-bottom-bar-item</router-link></code> and <code><router-link to="/components/steppers">md-step</router-link></code> so far.</p> | ||
<p>Vue Material router link components will be auto-generated with the prop <code>to</code>. All <a href="https://router.vuejs.org/en/api/router-link.html"><code>router-link</code> props</a> except <code>tag</code> accepted.</p> | ||
<h2 class="md-headline">Work with Router option <code>linkActiveClass</code></h2> | ||
<p>Since Vue Router doesn't expose <code>isSameRoute</code> and <code>isIncludedRoute</code> methods, Vue Material cannot detect which links are active. Vue Material inject <code>linkActiveClass</code> with an extra active class to interact with router. Therefore, if you want to using an custom class for active link as default, you need to setup like this:</p> | ||
<code-example title="Individual components"> | ||
const linkActiveClass = 'my-link-active-class' | ||
|
||
// pass custom class to Vue Material | ||
Vue.material.router.linkActiveClass = linkActiveClass | ||
|
||
// pass custom class to Vue Router | ||
router = new VueRouter({ | ||
routes, | ||
linkActiveClass | ||
}) | ||
|
||
const app = new Vue({ | ||
name: 'Root', | ||
router, | ||
}) | ||
|
||
</code-example> | ||
</div> | ||
</page-container> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'WithRouter' | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.