},
{
text: 'Changelog',
- link:
- 'https://github.com/vuejs/vue-router-next/blob/master/CHANGELOG.md',
+ link: 'https://github.com/vuejs/vue-router-next/blob/master/CHANGELOG.md',
},
],
},
{
text: '更新日志',
- link:
- 'https://github.com/vuejs/vue-router-next/blob/master/CHANGELOG.md',
+ link: 'https://github.com/vuejs/vue-router-next/blob/master/CHANGELOG.md',
},
],
<template>
<ParentLayout>
- <template #page-top-ads><span /></template>
- <template #page-top>
- <CarbonAds
- v-if="$site.themeConfig.carbonAds"
- :key="'carbon' + $page.relativePath"
- :code="$site.themeConfig.carbonAds.carbon"
- :placement="$site.themeConfig.carbonAds.placement"
- />
- </template>
- <template #page-bottom>
- <BuySellAds
- v-if="$site.themeConfig.carbonAds"
- :key="'custom' + $page.relativePath"
- :code="$site.themeConfig.carbonAds.custom"
- :placement="$site.themeConfig.carbonAds.placement"
- />
- </template>
<template #sidebar-bottom>
<div class="sponsors">
<a
<script>
import DefaultTheme from 'vitepress/dist/client/theme-default'
-import CarbonAds from './components/CarbonAds.vue'
-import BuySellAds from './components/BuySellAds.vue'
import sponsors from '../components/sponsors.json'
export default {
components: {
ParentLayout: DefaultTheme.Layout,
- CarbonAds,
- BuySellAds,
},
setup() {
</script>
<style>
+td code {
+ white-space: nowrap;
+}
+
form {
margin-block-end: 0;
}
+++ /dev/null
-<template>
- <div class="bsa-cpc-wrapper">
- <div class="bsa-cpc"></div>
- </div>
-</template>
-
-<script>
-import { onMounted } from 'vue'
-
-/* global _bsa */
-const ID = 'bsa-cpc-script'
-
-export default {
- name: 'BuySellAds',
- props: {
- code: {
- type: String,
- required: true,
- },
- placement: {
- type: String,
- required: true,
- },
- },
-
- setup(props) {
- function load() {
- if (typeof _bsa !== 'undefined' && _bsa) {
- _bsa.init('default', props.code, `placement:${props.placement}`, {
- target: '.bsa-cpc',
- align: 'horizontal',
- disable_css: 'true',
- })
- }
- }
-
- onMounted(() => {
- if (!document.getElementById(ID)) {
- const s = document.createElement('script')
- s.id = ID
- s.src = `//m.servedby-buysellads.com/monetization.js`
- document.head.appendChild(s)
- s.onload = () => {
- load()
- }
- } else {
- load()
- }
- })
- },
-}
-</script>
-
-<style>
-.bsa-cpc-wrapper {
- font-size: 0.95rem;
- /* from Page.vue */
- max-width: 50rem;
- margin: 0px auto;
- padding: 1rem 2rem 0;
- margin-bottom: -1rem;
-}
-
-@media (max-width: 419px) {
- .bsa-cpc-wrapper {
- padding: 0 1.5rem;
- }
-}
-
-.bsa-cpc {
- font-size: 0.9em;
- background-color: #f8f8f8;
- border-radius: 6px;
-}
-
-.bsa-cpc .default-text {
- display: inline;
-}
-
-.bsa-cpc a._default_ {
- text-align: left;
- display: block;
- text-decoration: none;
- padding: 10px 15px 12px;
- margin-bottom: 20px;
- color: #666;
- font-weight: 400;
- line-height: 18px;
-}
-
-.bsa-cpc a._default_ .default-image img {
- height: 20px;
- border-radius: 3px;
- vertical-align: middle;
- position: relative;
- top: -1px;
-}
-
-.bsa-cpc a._default_ .default-title {
- font-weight: 600;
-}
-
-.bsa-cpc a._default_ .default-description:after {
- font-size: 0.85em;
- content: 'Sponsored';
- color: #1c90f3;
- border: 1px solid #1c90f3;
- border-radius: 3px;
- padding: 0 4px 1px;
- margin-left: 6px;
-}
-
-.bsa-cpc .default-ad {
- display: none;
-}
-
-.bsa-cpc a._default_ .default-image,
-.bsa-cpc a._default_ .default-title,
-.bsa-cpc a._default_ .default-description {
- display: inline;
- vertical-align: middle;
- margin-right: 6px;
-}
-</style>
+++ /dev/null
-<template>
- <div class="carbon-ads" ref="el" />
-</template>
-
-<script lang="ts">
-import { defineComponent, ref, onMounted } from 'vue'
-
-export default defineComponent({
- props: {
- code: {
- type: String,
- required: true,
- },
- placement: {
- type: String,
- required: true,
- },
- },
-
- setup(props) {
- const el = ref()
- onMounted(() => {
- const s = document.createElement('script')
- s.id = '_carbonads_js'
- s.src = `//cdn.carbonads.com/carbon.js?serve=${props.code}&placement=${props.placement}`
- el.value.appendChild(s)
- })
-
- // TODO: change on route change
-
- return { el }
- },
-})
-</script>
-
-<style scoped>
-.carbon-ads {
- padding: 1.75rem 0 0;
- border-radius: 4px;
- margin: 0 auto;
- max-width: 280px;
- font-size: 0.75rem;
- background-color: rgba(255, 255, 255, 0.8);
-}
-
-.carbon-ads::after {
- clear: both;
- display: block;
- content: '';
-}
-
-@media (min-width: 420px) {
- .carbon-ads {
- position: relative;
- right: -8px;
- z-index: 1;
- float: right;
- margin: -8px -8px 24px 24px;
- padding: 8px;
- width: 146px;
- max-width: 100%;
- }
-}
-
-@media (max-width: 420px) {
- .carbon-ads {
- /* Avoid layout shift */
- height: 105px;
- }
-}
-
-@media (min-width: 1400px) {
- .carbon-ads {
- position: fixed;
- top: auto;
- right: 8px;
- bottom: 8px;
- float: none;
- margin: 0;
- }
-}
-
-.carbon-ads ::v-deep(.carbon-img) {
- float: left;
- margin-right: 0.75rem;
- max-width: 100px;
- border: 1px solid var(--c-divider);
-}
-
-@media (min-width: 420px) {
- .carbon-ads ::v-deep(.carbon-img) {
- float: none;
- display: block;
- margin-right: 0;
- max-width: 130px;
- }
-}
-
-.carbon-ads ::v-deep(.carbon-img img) {
- display: block;
- width: 100%;
-}
-
-@media (min-width: 420px) {
- .carbon-ads ::v-deep(.carbon-text) {
- padding-top: 8px;
- }
-}
-
-.carbon-ads ::v-deep(.carbon-text) {
- display: block;
- font-weight: 400;
- color: var(--c-text-light);
-}
-
-.carbon-ads ::v-deep(.carbon-poweredby) {
- display: block;
- padding-top: 2px;
- font-weight: 400;
- color: var(--c-text-lighter);
-}
-</style>
_Parameters_
-| Parameter | Type | Description |
-| ---------- | ----------------------------------- | ------------------- |
-| parentName | `string | symbol` | Parent Route Record where `route` should be appended at |
-| route | [`RouteRecordRaw`](#routerecordraw) | Route Record to add |
+| Parameter | Type | Description |
+| ---------- | ----------------------------------- | ------------------------------------------------------- |
+| parentName | `string \| symbol` | Parent Route Record where `route` should be appended at |
+| route | [`RouteRecordRaw`](#routerecordraw) | Route Record to add |
### addRoute
If you want to use a functional component, make sure to add a `displayName` to it.
For example:
+
```js
const HomeView = () => h('div', 'HomePage')
// in TypeScript, you will need to use the FunctionalComponent type
HomeView.displayName = 'HomeView'
const routes = [{ path: '/', component: HomeView }]
```
+
:::
## RouteRecordNormalized