Skip to content

Commit

Permalink
Update ko (#79)
Browse files Browse the repository at this point in the history
* chore: defining default values for Props using withDefaults (vuejs#1880)

* docs: reorder

* docs: fix index.md to avoid horizontal scrolling in code (vuejs#2129)

* docs: api updates

* chore: up packages
  • Loading branch information
niceplugin committed Mar 3, 2024
1 parent 47a27b7 commit 79a6877
Show file tree
Hide file tree
Showing 8 changed files with 196 additions and 180 deletions.
52 changes: 25 additions & 27 deletions docs/.vitepress/theme/components/HomeSponsorsGroup.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
<script setup lang="ts">
import sponsors from './sponsors.json'
import { computed } from 'vue'
import { useData } from 'vitepress'
const props = withDefaults(
defineProps<{
name: 'Gold' | 'Platinum' | 'Silver' | 'Bronze'
size?: number | string
}>(),
{
size: 140,
}
)
const { isDark } = useData()
const list = computed(() =>
sponsors[props.name.toLowerCase()].map(sponsor => ({
...sponsor,
imgSrc: isDark.value ? sponsor.imgSrcDark : sponsor.imgSrcLight,
}))
)
</script>

<template>
<h3>{{ name }} Sponsors</h3>

Expand Down Expand Up @@ -28,33 +53,6 @@
</p>
</template>

<script setup lang="ts">
import sponsors from './sponsors.json'
import { computed } from 'vue'
import type { PropType } from 'vue'
import { useData } from 'vitepress'
const { isDark } = useData()
const props = defineProps({
name: {
type: String as PropType<'Gold' | 'Platinum' | 'Silver' | 'Bronze'>,
required: true,
},
size: {
type: [Number, String],
default: 140,
},
})
const list = computed(() =>
sponsors[props.name.toLowerCase()].map((sponsor) => ({
...sponsor,
imgSrc: isDark.value ? sponsor.imgSrcDark : sponsor.imgSrcLight,
}))
)
</script>

<style scoped>
.sponsor_wrapper {
padding: 5px;
Expand Down
2 changes: 2 additions & 0 deletions docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ ___

โ€ข `Const` **RouterView**: () => \{ `$props`: `AllowedComponentProps` & `ComponentCustomProps` & `VNodeProps` & [`RouterViewProps`](interfaces/RouterViewProps.md) ; `$slots`: \{ `default?`: (`__namedParameters`: \{ `Component`: `VNode`\<`RendererNode`, `RendererElement`, \{ `[key: string]`: `any`; }\> ; `route`: [`RouteLocationNormalizedLoaded`](interfaces/RouteLocationNormalizedLoaded.md) }) => `VNode`\<`RendererNode`, `RendererElement`, \{ `[key: string]`: `any`; }\>[] } }

Component to display the current route the user is at.

#### Type declaration

โ€ข **new RouterView**(): `Object`
Expand Down
43 changes: 0 additions & 43 deletions docs/api/interfaces/Router.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ Add a new [route record](../index.md#RouteRecordRaw) as the child of an existing

โ–ธ (): `void`

Add a new [route record](../index.md#RouteRecordRaw) as the child of an existing route.

##### Returns

`void`
Expand All @@ -75,8 +73,6 @@ Add a new [route record](../index.md#RouteRecordRaw) to the router.

โ–ธ (): `void`

Add a new [route record](../index.md#RouteRecordRaw) to the router.

##### Returns

`void`
Expand Down Expand Up @@ -104,25 +100,10 @@ a function that removes the registered hook

โ–ธ (): `void`

Add a navigation hook that is executed after every navigation. Returns a
function that removes the registered hook.

##### Returns

`void`

a function that removes the registered hook

**`Example`**

```js
router.afterEach((to, from, failure) => {
if (isNavigationFailure(failure)) {
console.log('failed navigation', failure)
}
})
```

**`Example`**

```js
Expand Down Expand Up @@ -167,9 +148,6 @@ function that removes the registered guard.

โ–ธ (): `void`

Add a navigation guard that executes before any navigation. Returns a
function that removes the registered guard.

##### Returns

`void`
Expand Down Expand Up @@ -199,25 +177,10 @@ a function that removes the registered guard

โ–ธ (): `void`

Add a navigation guard that executes before navigation is about to be
resolved. At this state all component have been fetched and other
navigation guards have been successful. Returns a function that removes the
registered guard.

##### Returns

`void`

a function that removes the registered guard

**`Example`**

```js
router.beforeResolve(to => {
if (to.meta.requiresAuth && !isAuthenticated) return false
})
```

**`Example`**

```js
Expand Down Expand Up @@ -332,12 +295,6 @@ is required to render a route.

โ–ธ (): `void`

Adds an error handler that is called every time a non caught error happens
during navigation. This includes errors thrown synchronously and
asynchronously, errors returned or passed to `next` in any navigation
guard, and errors occurred when trying to resolve an async component that
is required to render a route.

##### Returns

`void`
Expand Down
7 changes: 0 additions & 7 deletions docs/api/interfaces/RouterHistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,10 @@ a callback to remove the listener

โ–ธ (): `void`

Attach a listener to the History implementation that is triggered when the
navigation is triggered from outside (like the Browser back and forward
buttons) or when passing `true` to RouterHistory.back and
RouterHistory.forward

##### Returns

`void`

a callback to remove the listener

___

### push
Expand Down
20 changes: 20 additions & 0 deletions docs/api/interfaces/RouterOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,23 @@ ___

โ€ข `Optional` **parseQuery**: (`search`: `string`) => [`LocationQuery`](../index.md#LocationQuery)

Custom implementation to parse a query. See its counterpart,
[RouterOptions.stringifyQuery](RouterOptions.md#stringifyQuery).

**`Example`**

Let's say you want to use the [qs package](https://github.com/ljharb/qs)
to parse queries, you can provide both `parseQuery` and `stringifyQuery`:
```js
import qs from 'qs'

createRouter({
// other options...
parseQuery: qs.parse,
stringifyQuery: qs.stringify,
})
```

#### Type declaration

โ–ธ (`search`): [`LocationQuery`](../index.md#LocationQuery)
Expand Down Expand Up @@ -170,6 +187,9 @@ ___

โ€ข `Optional` **stringifyQuery**: (`query`: [`LocationQueryRaw`](../index.md#LocationQueryRaw)) => `string`

Custom implementation to stringify a query object. Should not prepend a leading `?`.
[parseQuery](RouterOptions.md#parseQuery) counterpart to handle query parsing.

#### Type declaration

โ–ธ (`query`): `string`
Expand Down
6 changes: 4 additions & 2 deletions docs/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ Vue + Vue Router๋กœ ์‚ฌ์šฉํ•ด ์‹ฑ๊ธ€ ํŽ˜์ด์ง€ ์•ฑ์„ ๋งŒ๋“œ๋Š” ๊ฒƒ์€ ๋งค์šฐ
<p>
<!-- ํƒ์ƒ‰์„ ์œ„ํ•ด router-link ์ปดํฌ๋„ŒํŠธ๋ฅผ ์‚ฌ์šฉ. -->
<!-- `to`๋ผ๋Š” prop์œผ๋กœ ๋งํฌ๋ฅผ ์ง€์ •. -->
<!-- `<router-link>`๋Š” `href` ์†์„ฑ์ด ์žˆ๋Š” `<a>` ํƒœ๊ทธ๋กœ ๋ Œ๋”๋ง๋จ. -->
<!-- `<router-link>` ํƒœ๊ทธ๋Š” ์˜ฌ๋ฐ”๋ฅธ `href` ์†์„ฑ์„ ๊ฐ€์ง„ -->
<!-- `<a>` ํƒœ๊ทธ๋กœ ๋ Œ๋”๋ง ๋  ๊ฒƒ. -->
<router-link to="/">Home</router-link>
<router-link to="/about">About</router-link>
</p>
Expand Down Expand Up @@ -57,7 +58,8 @@ const routes = [
// 3. `routes`๋ฅผ ์˜ต์…˜์œผ๋กœ ์ „๋‹ฌํ•ด ๋ผ์šฐํ„ฐ ์ธ์Šคํ„ด์Šค๋ฅผ ์ƒ์„ฑ.
// ์—ฌ๊ธฐ์— ์ถ”๊ฐ€ ์˜ต์…˜์„ ์ „๋‹ฌํ•  ์ˆ˜ ์žˆ์ง€๋งŒ, ์ง€๊ธˆ์€ ๊ฐ„๋‹จํ•˜๊ฒŒ ๋‚˜ํƒ€๋ƒ„.
const router = createRouter({
// 4. ์‚ฌ์šฉํ•  ํžˆ์Šคํ† ๋ฆฌ ๋ชจ๋“œ ์ •์˜. ์—ฌ๊ธฐ์„œ๋Š” ๊ฐ„๋‹จํ•˜๊ฒŒ ํ•ด์‹œ ๋ชจ๋“œ๋ฅผ ์‚ฌ์šฉ.
// 4. ์‚ฌ์šฉํ•  ํžˆ์Šคํ† ๋ฆฌ ๋ชจ๋“œ ์ •์˜.
// ์—ฌ๊ธฐ์„œ๋Š” ๊ฐ„๋‹จํ•˜๊ฒŒ ํ•ด์‹œ ๋ชจ๋“œ๋ฅผ ์‚ฌ์šฉ.
history: createWebHashHistory(),
routes, // `routes: routes`์™€ ๊ฐ™์Œ
})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"build": "vitepress build docs"
},
"dependencies": {
"vitepress": "1.0.0-rc.35"
"vitepress": "1.0.0-rc.44"
}
}
Loading

0 comments on commit 79a6877

Please sign in to comment.