Skip to content

Commit

Permalink
📝 complete purehtml demo
Browse files Browse the repository at this point in the history
  • Loading branch information
howel52 committed Apr 7, 2020
1 parent f24ac7c commit ffcfdba
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
7 changes: 6 additions & 1 deletion docs/faq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ example:
2. export lifecycles in the entry

```javascript
const render = ($) => {
$('#purehtml-container').html("Hello, render with jQuery");
return Promise.resolve();
}

(global => {
global['purehtml'] = {
bootstrap: () => {
Expand All @@ -176,7 +181,7 @@ example:
},
mount: () => {
console.log('purehtml mount');
return Promise.resolve();
return render($)
},
unmount: () => {
console.log('purehtml unmount');
Expand Down
7 changes: 6 additions & 1 deletion docs/zh/faq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ qiankun 2.0 版本将提供一种更智能的方式使其自动化。
2. 在 entry js 里声明 lifecycles

```javascript
const render = ($) => {
$('#purehtml-container').html("Hello, render with jQuery");
return Promise.resolve();
}

(global => {
global['purehtml'] = {
bootstrap: () => {
Expand All @@ -258,7 +263,7 @@ qiankun 2.0 版本将提供一种更智能的方式使其自动化。
},
mount: () => {
console.log('purehtml mount');
return Promise.resolve();
return render($);
},
unmount: () => {
console.log('purehtml unmount');
Expand Down
7 changes: 6 additions & 1 deletion examples/purehtml/entry.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
const render = $ => {
$('#purehtml-container').html('Hello, render with jQuery');
return Promise.resolve();
};

(global => {
global['purehtml'] = {
bootstrap: () => {
Expand All @@ -6,7 +11,7 @@
},
mount: () => {
console.log('purehtml mount');
return Promise.resolve();
return render($);
},
unmount: () => {
console.log('purehtml unmount');
Expand Down
5 changes: 5 additions & 0 deletions examples/purehtml/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Purehtml Example</title>
<script
src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"
>
</script>
</head>
<body>
<div style="display: flex; justify-content: center; align-items: center; height: 200px;">
Purehtml Example
</div>
<div id="purehtml-container" style="text-align:center"></div>
</body>
<script src="//localhost:7104/entry.js" entry></script>
</html>

0 comments on commit ffcfdba

Please sign in to comment.