mirror of
https://github.com/muerwre/muerwre.github.io.git
synced 2025-04-25 02:46:39 +07:00
added whole content
This commit is contained in:
parent
1b5df685cb
commit
8b25e0631a
70 changed files with 5962 additions and 19 deletions
|
@ -0,0 +1,17 @@
|
|||
The topic's fully covered in the [official documentation](https://vuejs.org/guide/typescript/options-api.html#augmenting-global-properties) and in [Add global variable to window](Add%20global%20variable%20to%20window.md).
|
||||
|
||||
For example, you want to add global `$http` and `$translate` services to all of project's components:
|
||||
|
||||
```typescript
|
||||
// ~/index.d.ts or ~/custom.d.ts
|
||||
|
||||
import axios from 'axios'
|
||||
|
||||
declare module 'vue' {
|
||||
interface ComponentCustomProperties {
|
||||
$http: typeof axios
|
||||
$translate: (key: string) => string
|
||||
}
|
||||
}
|
||||
```
|
||||
|
16
content/Frontend/Vue/Make Nuxt handle Obsidian highlights.md
Normal file
16
content/Frontend/Vue/Make Nuxt handle Obsidian highlights.md
Normal file
|
@ -0,0 +1,16 @@
|
|||
By default [Nuxt Content Plugin](https://content.nuxtjs.org) not handling `==highlight==` links. To fix that we will create `Nitro` plugin:
|
||||
|
||||
```typescript
|
||||
// ~/server/plugins/highlight.ts
|
||||
export default defineNitroPlugin((nitroApp) => {
|
||||
nitroApp.hooks.hook("content:file:beforeParse", (file) => {
|
||||
if (file._id.endsWith(".md")) {
|
||||
file.body = file.body.replace(
|
||||
/==([^=]+)==/gs,
|
||||
`<span class="highlight">$1</span>`
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
```
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue