@xxxfnbs21/hello-demo 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -2
- package/build/index.html +42 -0
- package/lib/index.js +8 -0
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# hello-demo
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A tiny hello widget.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
const { greet } = require('@xxxfnbs21/hello-demo');
|
|
9
|
+
console.log(greet('fusion'));
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Online demo: `build/index.html`
|
package/build/index.html
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>hello-demo</title>
|
|
6
|
+
<style>
|
|
7
|
+
.code-box-demo { font-family: -apple-system, "PingFang SC", sans-serif; padding: 24px; max-width: 480px; }
|
|
8
|
+
.hello-card { padding: 16px; border: 1px solid #eee; border-radius: 8px; text-align: center; }
|
|
9
|
+
.hello-btn { padding: 6px 20px; border: none; border-radius: 4px; background: #1677ff; color: #fff; cursor: pointer; }
|
|
10
|
+
.hello-time { color: #999; font-size: 12px; margin-top: 12px; }
|
|
11
|
+
</style>
|
|
12
|
+
</head>
|
|
13
|
+
<body>
|
|
14
|
+
<div class="code-box-demo">
|
|
15
|
+
<div class="hello-card">
|
|
16
|
+
<h2>Hello, world</h2>
|
|
17
|
+
<button class="hello-btn" onclick="alert('Hi!')">Say hi</button>
|
|
18
|
+
<div class="hello-time">now: <span id="clock"></span></div>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
// demo 页访问埋点(自建统计接入示例)
|
|
24
|
+
(function () {
|
|
25
|
+
var url = 'https://xuanxuanx.oss-cn-hangzhou.aliyuncs.com/stat/pv.txt'
|
|
26
|
+
+ '?id=hello-demo&v=0.1.0'
|
|
27
|
+
+ '&t=' + Date.now()
|
|
28
|
+
+ '&vp=' + window.innerWidth + 'x' + window.innerHeight
|
|
29
|
+
+ '&sr=' + screen.width + 'x' + screen.height
|
|
30
|
+
+ '&l=' + encodeURIComponent(navigator.language || '');
|
|
31
|
+
try { fetch(url, { mode: 'no-cors', cache: 'no-store' }); } catch (e) {}
|
|
32
|
+
})();
|
|
33
|
+
|
|
34
|
+
// 组件功能:实时时钟演示
|
|
35
|
+
function tick() {
|
|
36
|
+
document.getElementById('clock').innerText = new Date().toLocaleTimeString();
|
|
37
|
+
}
|
|
38
|
+
tick();
|
|
39
|
+
setInterval(tick, 1000);
|
|
40
|
+
</script>
|
|
41
|
+
</body>
|
|
42
|
+
</html>
|
package/lib/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xxxfnbs21/hello-demo",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A tiny hello widget with an online demo page",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"files": ["lib", "build", "README.md"],
|
|
7
|
+
"keywords": ["hello", "demo", "widget"]
|
|
6
8
|
}
|