Skip to content

Commit e7afc2d

Browse files
committed
update example
1 parent 103b540 commit e7afc2d

File tree

4 files changed

+10
-28
lines changed

4 files changed

+10
-28
lines changed

examples/simple/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"title": "WebDataRender",
33
"description": "This page is a valid JSON. Check out the source!",
4-
"render": "<html hidden></html><script src=dist/render.js></script></html><noscript><style>html{display:block !important; white-space:pre}</style></noscript>"
4+
"render": "<html hidden><meta charset=utf-8></html><script src=dist/render.js></script></html><noscript><style>html{display:block !important; white-space:pre}</style></noscript>"
55
}

examples/simple/src/index.js

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,16 @@ wdrLoader(data=> {
66

77
function render(data) {
88

9-
document.title = 'WDR-loader example';
10-
11-
const html = document.getElementsByTagName('html')[0];
12-
html.innerHTML = `
13-
<html>
14-
<head>
9+
document.head.innerHTML = `
1510
<meta charset="utf-8">
1611
<meta name="viewport" content="width=device-width, initial-scale=1" />
1712
<title>${data.title}</title>
18-
<style>
19-
.main {
20-
background-color: aliceblue;
21-
text-align: center;
22-
padding: 16px;
23-
}
24-
</style>
25-
</head>
26-
<body>
27-
<section class="main">
28-
<div>
29-
<h1>${data.title}</h1>
30-
<p>${data.description}<p>
31-
</div>
32-
</section>
33-
</body>
34-
</html>
3513
`;
3614

15+
document.body.innerHTML = `
16+
<section>
17+
<h1>${data.title}</h1>
18+
<p>${data.description}<p>
19+
</section>`;
3720
}
21+

examples/simple/src/package-lock.json

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/simple/src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"author": "",
1010
"license": "ISC",
1111
"dependencies": {
12-
"wdr-loader": "^1.0.0"
12+
"wdr-loader": "file:../../.."
1313
},
1414
"devDependencies": {
1515
"webpack": "^5.6.0",

0 commit comments

Comments
 (0)