This repository was archived by the owner on Oct 25, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathdemo-json.html
More file actions
128 lines (117 loc) · 4.46 KB
/
Copy pathdemo-json.html
File metadata and controls
128 lines (117 loc) · 4.46 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!doctype html>
<html lang="zh-hant">
<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>JSON 編輯 - AdminUI 靜態範例</title>
<!-- 預連接 -->
<link rel="preconnect" href="https://cdn.jsdelivr.net/" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<!-- 預加載 Google Fonts -->
<link
rel="preload"
href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400&family=Noto+Sans+TC:wght@400&display=swap"
as="style"
crossorigin="anonymous"
/>
<link
href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400&family=Noto+Sans+TC:wght@400&display=swap"
rel="stylesheet"
crossorigin="anonymous"
/>
<!-- 預加載 Font Awesome 圖示 -->
<link rel="preload" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.2/css/all.min.css" as="style" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.2/css/all.min.css" defer crossorigin="anonymous" />
<!-- 預加載 QuickUI 前端框架 -->
<link rel="preload" href="https://cdn.jsdelivr.net/npm/@pardnchiu/quickui@0.6.6/dist/QuickUI.js" as="script" crossorigin="anonymous" />
<script src="https://cdn.jsdelivr.net/npm/@pardnchiu/quickui@0.6.6/dist/QuickUI.js" defer crossorigin="anonymous"></script>
<!-- 預加載 NanoJSON 編輯器 -->
<link rel="preload" href="https://cdn.jsdelivr.net/npm/@pardnchiu/nanojson@0.3.4/dist/NanoJSON.js" as="script" crossorigin="anonymous" />
<script src="https://cdn.jsdelivr.net/npm/@pardnchiu/nanojson@0.3.4/dist/NanoJSON.js" defer crossorigin="anonymous"></script>
<!-- 本地資源 -->
<link rel="stylesheet" href="./dist/AdminUI.css" />
<script src="./dist/AdminUI.js"></script>
<script src="./static/js/demo.js"></script>
</head>
<body id="body" :animation="fade-in">
<!-- * 純範例用,請直接透過後端渲染 -->
<section :if="is_guest" class="login">
<temp :path="./component/demo-login.html"></temp>
</section>
<section :else>
<!-- * 左側導覽列 (純範例用,請直接透過後端渲染) -->
<temp :path="./component/demo-left-tab.html"></temp>
<!-- 內容 -->
<section class="system-block-body-right">
<!-- * 頂部導覽列 (純範例用,請直接透過後端渲染) -->
<temp :path="./component/demo-right-nav.html"></temp>
<!-- -->
<section class="system-page-text">
<section>
<header>
<span>目前位置: {{ path }}</span>
<section>
<button>
<i class="fa-solid fa-trash-can"></i>
刪除
</button>
</section>
</header>
<!-- -->
<section>
<section id="JSONEditor"></section>
</section>
</section>
</section>
</section>
</section>
<script>
document.addEventListener("DOMContentLoaded", async (_) => {
const url = new URL(location.href);
const query = url.searchParams;
const path = query.get("path");
let previous = "/static/demo";
// * 純範例用,請直接透過後端渲染
let text;
await fetch(path)
.then((response) => response.text())
.then((data) => {
text = data;
})
.catch((error) => {
console.error(error);
});
demo_datas.left.is_demo_json = 1;
page = new QUI({
id: "body",
data: {
// * 純範例用,請直接透過後端渲染
...demo_datas,
isChild: path === previous,
path,
},
event: {
// * 純範例用,請直接透過後端渲染
...demo_events,
...system_events,
},
when: {
rendered: (_) => {
let dom = new JSONEditor({
id: "JSONEditor",
button: {
import: false,
export: false,
},
fill: 0,
});
dom.import(JSON.parse(text));
},
},
});
});
</script>
</body>
</html>