-
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
jindy
committed
Jun 18, 2022
1 parent
39ed1f4
commit 496b02a
Showing
11 changed files
with
211 additions
and
15 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
import { h, ref } from '../../lib/guide-mini-vue.esm.js' | ||
import Child from './Child.js' | ||
export const App = { | ||
name: 'App', | ||
setup() { | ||
const msg = ref('123') | ||
const count = ref(1) | ||
window.msg = msg | ||
const changeChildProps = () => { | ||
msg.value = '456' | ||
} | ||
const changeCount = () => { | ||
count.value++ | ||
} | ||
return { | ||
msg, | ||
count, | ||
changeChildProps, | ||
changeCount | ||
} | ||
}, | ||
render() { | ||
return h('div', {}, | ||
[ | ||
h('div', {}, '你好'), | ||
h('button', { onClick: this.changeChildProps }, 'change child props'), | ||
h(Child, { msg: this.msg }), | ||
h('button', { onClick: this.changeCount }, 'change self count'), | ||
h('p', {}, 'count:' + this.count) | ||
] | ||
) | ||
} | ||
} |
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,8 @@ | ||
import { h } from '../../lib/guide-mini-vue.esm.js' | ||
export default { | ||
name: 'Child', | ||
setup(props, { emit }) {}, | ||
render(proxy) { | ||
return h('div', {}, [h('div', {}, 'child - props - msg:' + this.$props.msg)]) | ||
} | ||
} |
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,16 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>component update</title> | ||
</head> | ||
|
||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="./main.js"></script> | ||
</body> | ||
|
||
</html> |
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,6 @@ | ||
|
||
import { createApp } from '../../lib/guide-mini-vue.esm.js' | ||
import { App } from './App.js' | ||
|
||
const rootContainer = document.querySelector('#app') | ||
createApp(App).mount(rootContainer) |
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
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.