Skip to content

Commit

Permalink
chore: organize the example structure
Browse files Browse the repository at this point in the history
  • Loading branch information
cuixiaorui committed Feb 4, 2021
1 parent c0212c0 commit 3fc7494
Show file tree
Hide file tree
Showing 20 changed files with 94 additions and 70 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
50 changes: 0 additions & 50 deletions example/App.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 组件 emit 逻辑 demo
// click emit 发出 change, 可以触发 App 组件内定义好的侦听函数
// 允许接收多个参数
import { h, ref, reactive } from "../../../lib/mini-vue.esm.js";
import { h, ref, reactive } from "../../lib/mini-vue.esm.js";
import Child from "./Child.js";

export default {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { h, ref, reactive } from "../../../lib/mini-vue.esm.js";
import { h, ref, reactive } from "../../lib/mini-vue.esm.js";
export default {
name: "Child",
setup(props, { emit }) {
Expand Down
File renamed without changes.
15 changes: 0 additions & 15 deletions example/components/HelloWorld.js

This file was deleted.

24 changes: 24 additions & 0 deletions example/helloWorld/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { h,ref } from "../../lib/mini-vue.esm.js";

const count = ref(0)

const HelloWorld = {
name: "HelloWorld",
setup() {},
render() {
return h(
"div",
{ tId: "helloWorld" },
`hello world: count: ${count.value}`
);
},
};

export default {
name: "App",
setup() {},

render() {
return h("div", { tId: 1 }, [h("p", {}, "主页"), h(HelloWorld)]);
},
};
File renamed without changes.
5 changes: 5 additions & 0 deletions example/helloWorld/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createApp } from "../../lib/mini-vue.esm.js";
import App from "./App.js";

const rootContainer = document.querySelector("#root");
createApp(App).mount(rootContainer);
11 changes: 11 additions & 0 deletions example/nextTicker/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { h, ref, reactive } from "../../lib/mini-vue.esm.js";
import NextTicker from "./NextTicker.js";

export default {
name: "App",
setup() {},

render() {
return h("div", { tId: 1 }, [h("p", {}, "主页"), h(NextTicker)]);
},
};
File renamed without changes.
15 changes: 15 additions & 0 deletions example/nextTicker/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>

<div id="root"></div>

<script src="main.js" type="module"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion example/main.js → example/nextTicker/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createApp} from "../lib/mini-vue.esm.js";
import {createApp} from "../../lib/mini-vue.esm.js";
import App from "./App.js";

const rootContainer = document.querySelector("#root");
Expand Down
11 changes: 11 additions & 0 deletions example/patchChildren/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { h } from "../../lib/mini-vue.esm.js";
import PatchChildren from "./PatchChildren.js";

export default {
name: "App",
setup() {},

render() {
return h("div", { tId: 1 }, [h("p", {}, "主页"), h(PatchChildren)]);
},
};
File renamed without changes.
15 changes: 15 additions & 0 deletions example/patchChildren/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>

<div id="root"></div>

<script src="main.js" type="module"></script>
</body>
</html>
5 changes: 5 additions & 0 deletions example/patchChildren/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createApp } from "../../lib/mini-vue.esm.js";
import App from "./App.js";

const rootContainer = document.querySelector("#root");
createApp(App).mount(rootContainer);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { h, ref, reactive } from "../../../lib/mini-vue.esm.js";
import { h, ref, reactive } from "../../lib/mini-vue.esm.js";
import Child from "./Child.js";

export default {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { h, ref, reactive } from "../../../lib/mini-vue.esm.js";
import { h, ref, reactive } from "../../lib/mini-vue.esm.js";
export default {
name: "Child",
setup(props, context) {
Expand Down
File renamed without changes.

0 comments on commit 3fc7494

Please sign in to comment.