Skip to content

Commit eb4c2d5

Browse files
docs: add vue school links (#1045)
1 parent 3dad59c commit eb4c2d5

File tree

7 files changed

+72
-3
lines changed

7 files changed

+72
-3
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<template>
2+
<div class="vueschool">
3+
<a
4+
:href="`${href}?friend=vuerouter`"
5+
target="_blank"
6+
rel="sponsored noopener"
7+
:title="title"
8+
>
9+
<slot>Watch a free video lesson on Vue School</slot>
10+
</a>
11+
</div>
12+
</template>
13+
<script>
14+
export default {
15+
props: {
16+
href: { type: String, required: true },
17+
title: { type: String, required: true },
18+
},
19+
}
20+
</script>
21+
<style scoped>
22+
.vueschool {
23+
margin-top: 20px;
24+
background-color: var(--code-bg-color);
25+
padding: 1em 1.25em;
26+
border-radius: 2px;
27+
position: relative;
28+
display: flex;
29+
}
30+
.vueschool a {
31+
color: var(--c-text);
32+
position: relative;
33+
padding-left: 36px;
34+
}
35+
.vueschool a:before {
36+
content: '';
37+
position: absolute;
38+
display: block;
39+
width: 30px;
40+
height: 30px;
41+
top: calc(50% - 15px);
42+
left: -4px;
43+
border-radius: 50%;
44+
background-color: #73abfe;
45+
}
46+
.vueschool a:after {
47+
content: '';
48+
position: absolute;
49+
display: block;
50+
width: 0;
51+
height: 0;
52+
top: calc(50% - 5px);
53+
left: 8px;
54+
border-top: 5px solid transparent;
55+
border-bottom: 5px solid transparent;
56+
border-left: 8px solid #fff;
57+
}
58+
</style>

packages/docs/.vitepress/theme/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Theme from 'vitepress/theme'
2+
import VueSchoolLink from '../components/VueSchoolLink.vue'
23
import { Layout } from './Layout'
34
import './custom.css'
45
import './code-theme.css'
@@ -10,9 +11,9 @@ const config = {
1011

1112
Layout,
1213

13-
// enhanceApp({ app }) {
14-
// app.use(createPinia())
15-
// },
14+
enhanceApp({ app }) {
15+
app.component('VueSchoolLink', VueSchoolLink)
16+
},
1617
}
1718

1819
export default config

packages/docs/core-concepts/actions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Actions
22

3+
<VueSchoolLink href="https://vueschool.io/lessons/synchronous-and-asynchronous-actions-in-pinia"/>
4+
35
Actions are the equivalent of [methods](https://v3.vuejs.org/guide/data-methods.html#methods) in components. They can be defined with the `actions` property in `defineStore()` and **they are perfect to define business logic**:
46

57
```js

packages/docs/core-concepts/getters.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Getters
22

3+
<VueSchoolLink href="https://vueschool.io/lessons/getters-in-pinia"/>
4+
35
Getters are exactly the equivalent of [computed values](https://v3.vuejs.org/guide/reactivity-computed-watchers.html#computed-values) for the state of a Store. They can be defined with the `getters` property in `defineStore()`. They receive the `state` as the first parameter **to encourage** the usage of arrow function:
46

57
```js

packages/docs/core-concepts/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Defining a Store
22

3+
<VueSchoolLink href="https://vueschool.io/lessons/define-your-first-pinia-store"/>
4+
35
Before diving into core concepts, we need to know that a store is defined using `defineStore()` and that it requires a **unique** name, passed as the first argument:
46

57
```js

packages/docs/core-concepts/state.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# State
22

3+
<VueSchoolLink href="https://vueschool.io/lessons/access-state-from-a-pinia-store"/>
4+
35
The state is, most of the time, the central part of your store. People often start by defining the state that represents their app. In Pinia the state is defined as a function that returns the initial state. This allows Pinia to work in both Server and Client Side.
46

57
```js

packages/docs/introduction.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Introduction
22

3+
<VueSchoolLink href="https://vueschool.io/lessons/introduction-to-pinia"/>
4+
35
Pinia [started](https://github.com/vuejs/pinia/commit/06aeef54e2cad66696063c62829dac74e15fd19e) as an experiment to redesign what a Store for Vue could look like with the [Composition API](https://github.com/vuejs/composition-api) around November 2019. Since then, the initial principles are still the same, but Pinia works for both Vue 2 and Vue 3 **and doesn't require you to use the composition API**. The API is the same for both except for _installation_ and _SSR_, and these docs are targeted to Vue 3 **with notes about Vue 2** whenever necessary so it can be read by Vue 2 and Vue 3 users!
46

57
## Why should I use Pinia?

0 commit comments

Comments
 (0)