forked from cuixiaorui/mini-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a4bcabf
commit b82ade3
Showing
11 changed files
with
1,886 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,37 @@ | ||
import { h } from "../lib/mini-vue.esm.js"; | ||
import HelloWorld from "./components/HelloWorld.js"; | ||
import { h,ref } from "../lib/mini-vue.esm.js"; | ||
// import HelloWorld from "./components/HelloWorld.js"; | ||
// import { h, ref } from "../../lib/mini-vue.esm.js"; | ||
|
||
const count = ref(1); | ||
const HelloWorld = { | ||
name: "HelloWorld", | ||
setup() {}, | ||
render() { | ||
return h( | ||
"div", | ||
{ tId: "helloWorld" }, | ||
`hello world: count: ${count.value}` | ||
); | ||
}, | ||
}; | ||
|
||
export default { | ||
name:"App", | ||
name: "App", | ||
setup() {}, | ||
|
||
render() { | ||
return h("div", { tId: 1 }, [h("p", {}, "你好,我是p"), h(HelloWorld)]); | ||
return h("div", { tId: 1 }, [ | ||
h("p", {}, "你好,我是p"), | ||
h( | ||
"button", | ||
{ | ||
onclick: () => { | ||
count.value++; | ||
}, | ||
}, | ||
"点我啊!" | ||
), | ||
h(HelloWorld), | ||
]); | ||
}, | ||
}; |
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 |
---|---|---|
@@ -1,8 +1,16 @@ | ||
import { h } from "../../lib/mini-vue.esm.js"; | ||
import { h, ref } from "../../lib/mini-vue.esm.js"; | ||
|
||
// 临时模拟使用 refs | ||
// 后面需要支持在 setup 内导出 | ||
// 然后在 render 内导入 | ||
// 这需要实现 proxy | ||
|
||
const count = ref(1); | ||
window.count = count; | ||
export default { | ||
name: "HelloWorld", | ||
setup() {}, | ||
render() { | ||
return h("div", { tId: "helloWorld" }, "hello world vue3"); | ||
return h("div", { tId: "helloWorld" }, `hello world: count: ${count.value}`); | ||
}, | ||
}; |
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.