Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(md-enhance): add playground and vue playground (#2202)
- Loading branch information
1 parent
4c87572
commit 7c8cfff
Showing
60 changed files
with
7,074 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
--- | ||
title: Playground | ||
--- | ||
|
||
## Demo | ||
|
||
### TS | ||
|
||
::: playground#ts TS demo 1 | ||
|
||
@file index.ts | ||
|
||
```ts | ||
const msg = "hello world"; | ||
|
||
const speak = (msg: string) => console.log(msg); | ||
|
||
speak(msg); | ||
``` | ||
|
||
::: | ||
|
||
::: playground#ts TS demo 2 | ||
|
||
@file index.ts | ||
|
||
```ts | ||
const msg = "hello world"; | ||
|
||
const speak = (msg: string) => console.log(msg); | ||
|
||
speak(msg); | ||
``` | ||
|
||
@settings | ||
|
||
```json | ||
{ | ||
"target": "es5" | ||
} | ||
``` | ||
|
||
::: | ||
|
||
### Vue | ||
|
||
::: playground#vue Vue demo with cutomized imports | ||
|
||
@file App.vue | ||
|
||
```vue | ||
<script setup> | ||
import { ref } from "vue"; | ||
import Comp from "./Comp.vue"; | ||
const msg = ref("Hello World!"); | ||
</script> | ||
<template> | ||
<h1>{{ msg }}</h1> | ||
<input v-model="msg" /> | ||
<Comp /> | ||
</template> | ||
``` | ||
|
||
@file Comp.vue | ||
|
||
```vue | ||
<template> | ||
<div>Comp</div> | ||
</template> | ||
``` | ||
|
||
@import | ||
|
||
```json | ||
{ | ||
"imports": { | ||
"vue": "https://sfc.vuejs.org/vue.runtime.esm-browser.js" | ||
} | ||
} | ||
``` | ||
|
||
::: | ||
|
||
::: playground#vue Vue demo with customized settings | ||
|
||
@file App.vue | ||
|
||
```vue | ||
<script setup> | ||
import { ref } from "vue"; | ||
const msg = ref("Hello Playground!"); | ||
</script> | ||
<template> | ||
<h1>{{ msg }}</h1> | ||
<input v-model="msg" /> | ||
</template> | ||
``` | ||
|
||
@setting | ||
|
||
```json | ||
{ | ||
"dev": true, | ||
"ssr": true | ||
} | ||
``` | ||
|
||
::: |
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,82 @@ | ||
--- | ||
title: Vue Playground | ||
--- | ||
|
||
## Demo | ||
|
||
::: vue-playground Vue Playground | ||
|
||
@file App.vue | ||
|
||
```vue | ||
<script setup> | ||
import { ref } from "vue"; | ||
const msg = ref("Hello Playground!"); | ||
</script> | ||
<template> | ||
<h1>{{ msg }}</h1> | ||
<input v-model="msg" /> | ||
</template> | ||
``` | ||
|
||
::: | ||
|
||
::: vue-playground Vue Playground with cutomized settings and import | ||
|
||
@file App.vue | ||
|
||
```vue | ||
<script setup> | ||
import { ref } from "vue"; | ||
import Comp from "./Comp.vue"; | ||
const msg = ref("Hello Playground!"); | ||
</script> | ||
<template> | ||
<h1>{{ msg }}</h1> | ||
<input v-model="msg" /> | ||
<Comp /> | ||
</template> | ||
``` | ||
|
||
@file Comp.vue | ||
|
||
```vue | ||
<script setup> | ||
import { useBattery } from "@vueuse/core"; | ||
import { ref } from "vue"; | ||
const { charging, level } = useBattery(); | ||
</script> | ||
<template> | ||
<h1>Battery status</h1> | ||
<p>Charging: {{ charging }}</p> | ||
<p>Level: {{ level * 100 }}%</p> | ||
</template> | ||
``` | ||
|
||
@import | ||
|
||
```json | ||
{ | ||
"imports": { | ||
"@vueuse/core": "https://unpkg.com/@vueuse/core/index.mjs", | ||
"@vueuse/shared": "https://unpkg.com/@vueuse/shared/index.mjs", | ||
"vue-demi": "https://unpkg.com/vue-demi/lib/index.mjs" | ||
} | ||
} | ||
``` | ||
|
||
@setting | ||
|
||
```json | ||
{ | ||
"showCompileOutput": true | ||
} | ||
``` | ||
|
||
::: |
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.