1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
| <!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>mini vue</title> <style>
</style> </head> <body> <div id="app"></div> <script src="./01_render.js"></script> <script> function tap(e) { e.preventDefault()
console.log(e.target) return false } function tap02(e) { e.preventDefault()
console.log('tap 02', e.target) return false } let vnode = h('div', {}, [ h('div', { style: { color: 'red', width: '200px', height: '100px' } }, [ h('h3', { color: 'yellow', OnClick: tap }, [h('wht is you life ?')]), h('h3', { color: 'green', OnClick: tap }, [ h('wht is you life ? joy') ]), h('input', {}, []) ]), h('div', { style: { color: 'red' } }, [ h('h3', { color: 'yellow', OnClick: tap }, [h('wht is you life ?')]), h('h2', { style: { color: 'tan' }, OnClick: tap }, [ h('wht is you life ?') ]), h('h2', { style: { color: 'orange' }, OnClick: tap }, [ h('wht is you life ? ros') ]) ]), h('h1', { style: { color: 'purple' }, OnClick: tap }, [h('nothing.')]) ]) let vnode2 = h('div', {}, [ h('div', { style: { color: 'red', width: '200px', height: '100px' } }, [ h('h3', { color: 'yellow', OnClick: tap02 }, [ h('wht is you life ?') ]), h('h3', { color: 'green', OnClick: tap02 }, [ h('wht is you life ? joy') ]), h('input', {}, []) ]), h('div', { style: { color: 'green' } }, [ h('h3', { color: 'yellow', OnClick: tap02 }, [ h('wht is you life ?') ]), h('h2', { style: { color: 'purple' }, OnClick: tap02 }, [ h('wht is you life ?') ]), h('h2', { style: { color: 'gold' }, OnClick: tap02 }, [ h('wht is you life ? ros') ]) ]), h('h1', { style: { color: 'blue' }, OnClick: tap02 }, [h('nothing.')]) ])
mount(vnode2, '#app') console.log('o', vnode) console.log('n', vnode2) setTimeout(() => patch(vnode2, vnode), 5000) </script> </body> </html>
|