Skip to content

Commit

Permalink
feat: CanvasDEMO
Browse files Browse the repository at this point in the history
  • Loading branch information
songxingguo committed Apr 23, 2024
1 parent 711cc4e commit 52c1180
Show file tree
Hide file tree
Showing 25 changed files with 460 additions and 16 deletions.
20 changes: 20 additions & 0 deletions src/.vuepress/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ import DrawRectangle from "./components/Canvas/DrawRectangle.vue";
import DrawText from "./components/Canvas/DrawText.vue";
import PlayVideo from "./components/Canvas/PlayVideo.vue";
import Screenshot from "./components/Canvas/Screenshot.vue";
import CanvasComposition from "./components/CanvasBasic/CanvasComposition.vue";
import CanvasGradient from "./components/CanvasBasic/CanvasGradient.vue";
import DrawCircle from "./components/CanvasBasic/DrawCircle.vue";
import DrawGraphics from "./components/CanvasBasic/DrawGraphics.vue";
import DrawImage from "./components/CanvasBasic/DrawImage.vue";
import DrawLine from "./components/CanvasBasic/DrawLine.vue";
import DrawRectangle from "./components/CanvasBasic/DrawRectangle.vue";
import DrawText from "./components/CanvasBasic/DrawText.vue";
import PlayVideo from "./components/CanvasBasic/PlayVideo.vue";
import Screenshot from "./components/CanvasBasic/Screenshot.vue";
import DicePractice from "./components/FlexLayout/DicePractice.vue";
import HolyGrailLayout from "./components/FlexLayout/HolyGrailLayout.vue";
import ResponsivePage from "./components/FlexLayout/ResponsivePage.vue";
Expand Down Expand Up @@ -67,6 +77,16 @@ app.component("DrawRectangle", DrawRectangle);
app.component("DrawText", DrawText);
app.component("PlayVideo", PlayVideo);
app.component("Screenshot", Screenshot);
app.component("CanvasComposition", CanvasComposition);
app.component("CanvasGradient", CanvasGradient);
app.component("DrawCircle", DrawCircle);
app.component("DrawGraphics", DrawGraphics);
app.component("DrawImage", DrawImage);
app.component("DrawLine", DrawLine);
app.component("DrawRectangle", DrawRectangle);
app.component("DrawText", DrawText);
app.component("PlayVideo", PlayVideo);
app.component("Screenshot", Screenshot);
app.component("DicePractice", DicePractice);
app.component("HolyGrailLayout", HolyGrailLayout);
app.component("ResponsivePage", ResponsivePage);
Expand Down
8 changes: 5 additions & 3 deletions src/.vuepress/components/Canvas/PlayVideo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@ import useHtml from "@hooks/useHtml.js";
const el = ref();
onMounted(async () => {
const { html, css, } = await useHtml("/demo/Canvas/PlayVideo.html");
const { html, css, js } = await useHtml("/demo/Canvas/PlayVideo.html");
new MiniSandbox({
el: el.value,
files: {
"index.html": {
defaultValue: html,
jsLibs: ["index.js"],
},
"index.js": {
defaultValue: js,
},
},
defaultConfig: {
height: "500px",
Expand Down
14 changes: 9 additions & 5 deletions src/.vuepress/components/Canvas/Screenshot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ import useHtml from "@hooks/useHtml.js";
const el = ref();
onMounted(async () => {
const { html, css, } = await useHtml("/demo/Canvas/Screenshot.html");
const { html, css, js } = await useHtml("/demo/Canvas/Screenshot.html");
new MiniSandbox({
el: el.value,
files: {
"index.html": {
defaultValue: html,
cssLibs: ["index.css"],
jsLibs: ["index.js"],
},
"index.css": {
defaultValue: css,
},
"index.js": {
defaultValue: js,
},
},
defaultConfig: {
height: "500px",
Expand Down
35 changes: 35 additions & 0 deletions src/.vuepress/components/CanvasBasic/CanvasComposition.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

<template>
<div ref="el"></div>
</template>

<script setup>
import { ref, onMounted } from "vue";
import useHtml from "@hooks/useHtml.js";
const el = ref();
onMounted(async () => {
const { html, css, js } = await useHtml("/demo/CanvasBasic/CanvasComposition.html");
new MiniSandbox({
el: el.value,
files: {
"index.html": {
defaultValue: html,
cssLibs: ["index.css"],
jsLibs: ["index.js"],
},
"index.css": {
defaultValue: css,
},
"index.js": {
defaultValue: js,
},
},
defaultConfig: {
height: "500px",
},
});
});
</script>
35 changes: 35 additions & 0 deletions src/.vuepress/components/CanvasBasic/CanvasGradient.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

<template>
<div ref="el"></div>
</template>

<script setup>
import { ref, onMounted } from "vue";
import useHtml from "@hooks/useHtml.js";
const el = ref();
onMounted(async () => {
const { html, css, js } = await useHtml("/demo/CanvasBasic/CanvasGradient.html");
new MiniSandbox({
el: el.value,
files: {
"index.html": {
defaultValue: html,
cssLibs: ["index.css"],
jsLibs: ["index.js"],
},
"index.css": {
defaultValue: css,
},
"index.js": {
defaultValue: js,
},
},
defaultConfig: {
height: "500px",
},
});
});
</script>
35 changes: 35 additions & 0 deletions src/.vuepress/components/CanvasBasic/DrawCircle.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

<template>
<div ref="el"></div>
</template>

<script setup>
import { ref, onMounted } from "vue";
import useHtml from "@hooks/useHtml.js";
const el = ref();
onMounted(async () => {
const { html, css, js } = await useHtml("/demo/CanvasBasic/DrawCircle.html");
new MiniSandbox({
el: el.value,
files: {
"index.html": {
defaultValue: html,
cssLibs: ["index.css"],
jsLibs: ["index.js"],
},
"index.css": {
defaultValue: css,
},
"index.js": {
defaultValue: js,
},
},
defaultConfig: {
height: "500px",
},
});
});
</script>
35 changes: 35 additions & 0 deletions src/.vuepress/components/CanvasBasic/DrawGraphics.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

<template>
<div ref="el"></div>
</template>

<script setup>
import { ref, onMounted } from "vue";
import useHtml from "@hooks/useHtml.js";
const el = ref();
onMounted(async () => {
const { html, css, js } = await useHtml("/demo/CanvasBasic/DrawGraphics.html");
new MiniSandbox({
el: el.value,
files: {
"index.html": {
defaultValue: html,
cssLibs: ["index.css"],
jsLibs: ["index.js"],
},
"index.css": {
defaultValue: css,
},
"index.js": {
defaultValue: js,
},
},
defaultConfig: {
height: "500px",
},
});
});
</script>
35 changes: 35 additions & 0 deletions src/.vuepress/components/CanvasBasic/DrawImage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

<template>
<div ref="el"></div>
</template>

<script setup>
import { ref, onMounted } from "vue";
import useHtml from "@hooks/useHtml.js";
const el = ref();
onMounted(async () => {
const { html, css, js } = await useHtml("/demo/CanvasBasic/DrawImage.html");
new MiniSandbox({
el: el.value,
files: {
"index.html": {
defaultValue: html,
cssLibs: ["index.css"],
jsLibs: ["index.js"],
},
"index.css": {
defaultValue: css,
},
"index.js": {
defaultValue: js,
},
},
defaultConfig: {
height: "500px",
},
});
});
</script>
35 changes: 35 additions & 0 deletions src/.vuepress/components/CanvasBasic/DrawLine.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

<template>
<div ref="el"></div>
</template>

<script setup>
import { ref, onMounted } from "vue";
import useHtml from "@hooks/useHtml.js";
const el = ref();
onMounted(async () => {
const { html, css, js } = await useHtml("/demo/CanvasBasic/DrawLine.html");
new MiniSandbox({
el: el.value,
files: {
"index.html": {
defaultValue: html,
cssLibs: ["index.css"],
jsLibs: ["index.js"],
},
"index.css": {
defaultValue: css,
},
"index.js": {
defaultValue: js,
},
},
defaultConfig: {
height: "500px",
},
});
});
</script>
35 changes: 35 additions & 0 deletions src/.vuepress/components/CanvasBasic/DrawRectangle.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

<template>
<div ref="el"></div>
</template>

<script setup>
import { ref, onMounted } from "vue";
import useHtml from "@hooks/useHtml.js";
const el = ref();
onMounted(async () => {
const { html, css, js } = await useHtml("/demo/CanvasBasic/DrawRectangle.html");
new MiniSandbox({
el: el.value,
files: {
"index.html": {
defaultValue: html,
cssLibs: ["index.css"],
jsLibs: ["index.js"],
},
"index.css": {
defaultValue: css,
},
"index.js": {
defaultValue: js,
},
},
defaultConfig: {
height: "500px",
},
});
});
</script>
35 changes: 35 additions & 0 deletions src/.vuepress/components/CanvasBasic/DrawText.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

<template>
<div ref="el"></div>
</template>

<script setup>
import { ref, onMounted } from "vue";
import useHtml from "@hooks/useHtml.js";
const el = ref();
onMounted(async () => {
const { html, css, js } = await useHtml("/demo/CanvasBasic/DrawText.html");
new MiniSandbox({
el: el.value,
files: {
"index.html": {
defaultValue: html,
cssLibs: ["index.css"],
jsLibs: ["index.js"],
},
"index.css": {
defaultValue: css,
},
"index.js": {
defaultValue: js,
},
},
defaultConfig: {
height: "500px",
},
});
});
</script>
Loading

0 comments on commit 52c1180

Please # to comment.