-
Notifications
You must be signed in to change notification settings - Fork 76
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
jinfeiyang
committed
Sep 9, 2020
1 parent
e5cd6f8
commit 52bd369
Showing
11 changed files
with
293 additions
and
119 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<!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"> | ||
<script src="https://cdn.jsdelivr.net/npm/eruda"></script> | ||
<script>eruda.init();</script> | ||
<style> | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body style="background:#fff;"> | ||
<canvas id="canvas" style="width:100%; height:100%;position:fixed;"></canvas> | ||
|
||
<script src="../dist/easy-canvas.min.js"></script> | ||
<script src="./draw.js"></script> | ||
<script> | ||
window.onload = function () { | ||
main() | ||
|
||
} | ||
window.onresize = function () { | ||
main() | ||
} | ||
|
||
function main() { | ||
const canvas = document.querySelector('#canvas') | ||
|
||
const ctx = canvas.getContext('2d') | ||
const dpr = window.devicePixelRatio | ||
const w = window.innerWidth | ||
const h = window.innerHeight | ||
canvas.width = w * dpr | ||
canvas.height = h * dpr | ||
ctx.scale(dpr, dpr) | ||
layer = easyCanvas.createLayer(ctx, { dpr, width: w, height: h, debug: false }) | ||
|
||
const node = easyCanvas.createElement((h) => { | ||
return h('scroll-view', { | ||
styles: { | ||
width: w, | ||
height: window.innerHeight, | ||
direction: 'xy' | ||
}, | ||
attrs: { | ||
renderOnDemand: true | ||
} | ||
}, | ||
[ | ||
...drawTable(h) | ||
] | ||
) | ||
}) | ||
|
||
console.log(node) | ||
node.mount(layer) | ||
} | ||
|
||
// 注册全局组件 | ||
canvas.ontouchstart = ontouchstart | ||
canvas.ontouchmove = ontouchmove | ||
canvas.ontouchend = ontouchend | ||
canvas.onclick = onClick | ||
|
||
</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
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.