Skip to content

Commit 261713b

Browse files
committed
引入了新的狀態監控方法 before_destorydestroyed,用來監控應用在銷毀前及銷毀後的狀態變化。
1 parent 89ba7fc commit 261713b

12 files changed

Lines changed: 40 additions & 39 deletions

File tree

dist/PDQuickUI.js

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

dist/PDQuickUI.module.js

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

index.html

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,14 @@
6565
</head>
6666

6767
<body id="app" class="dom-temp">
68-
<h1 :id="title" :if="heading == 1">{{ title }} 1</h1>
69-
<h2 :else-if="isH2">{{ title }} 2</h2>
70-
<h3 :else-if="heading == 3">{{ title }} 3</h3>
71-
<h4 :else>{{ title }} 4</h4>
68+
<h1 :id="title" :if="heading == 1">{{ title }} 1
69+
{{ string }} {{ CALC(num * 10) }} {{ DATE(now, YYYY-MM-DD hh:mm:ss) }}</h1>
70+
<h2 :else-if="isH2">{{ title }} 2
71+
{{ string }} {{ CALC(num * 10) }} {{ DATE(now, YYYY-MM-DD hh:mm:ss) }}</h2>
72+
<h3 :else-if="heading == 3">{{ title }} 3
73+
{{ string }} {{ CALC(num * 10) }} {{ DATE(now, YYYY-MM-DD hh:mm:ss) }}</h3>
74+
<h4 :else>{{ title }} 4
75+
{{ string }} {{ CALC(num * 10) }} {{ DATE(now, YYYY-MM-DD hh:mm:ss) }}</h4>
7276
<br>
7377
<!-- <p :html="html" :bg-color="#000" :color="#ff0000">adfasdf</p> -->
7478
<!-- <input type="text" :model="title"> -->
@@ -78,22 +82,25 @@ <h4 :else>{{ title }} 4</h4>
7882
<ul>
7983
<li :for="(key, val) in obj" :@click="val.click">
8084
{{ key }}: {{ val.name }}
85+
{{ string }} {{ CALC(num * 10) }} {{ DATE(now, YYYY-MM-DD hh:mm:ss) }}
8186
<ul>
8287
<li :for="item in val.ary">
8388
{{ item.name }}
89+
{{ string }} {{ CALC(num * 10) }} {{ DATE(now, YYYY-MM-DD hh:mm:ss) }}
8490
<ul>
8591
<li :for="(item1, index1) in item.ary1">
8692
{{ CALC(index1 + 1) }}. {{ item1.name }} - ${{ item1.price }}
93+
{{ string }} {{ CALC(num * 10) }} {{ DATE(now, YYYY-MM-DD hh:mm:ss) }}
8794
</li>
8895
</ul>
8996
</li>
9097
</ul>
9198
</li>
9299
</ul>
93-
<br>
94-
{{ string }} {{ CALC(num * 10) }} {{ DATE(now, YYYY-MM-DD hh:mm:ss) }}
95100
<ul>
96-
<li :for="(item, index) in ary" :id="item" :index="index">{{ item }} {{ CALC(index + 1) }}</li>
101+
<li :for="(item, index) in ary" :id="item" :index="index">{{ item }} {{ CALC(index + 1) }}
102+
{{ string }} {{ CALC(num * 10) }} {{ DATE(now, YYYY-MM-DD hh:mm:ss) }}</li>
103+
{{ string }} {{ CALC(num * 10) }} {{ DATE(now, YYYY-MM-DD hh:mm:ss) }}
97104
</ul>
98105
<img :lazyload="src" alt="">
99106
<p @click="click">Total: {{ LENGTH(array) }}</p>
@@ -175,30 +182,32 @@ <h4 :else>{{ title }} 4</h4>
175182
console.log(app.data)
176183
}
177184
},
178-
before_render: _ => {
179-
console.log("準備渲染")
180-
// return false;
181-
},
182-
rendered: _ => {
183-
// setTimeout(_ => {
185+
lifecycle: {
186+
before_render: _ => {
187+
console.log("準備渲染")
188+
// return false;
189+
},
190+
rendered: _ => {
191+
// setTimeout(_ => {
184192

185-
// app.data.heading = 3
186-
// }, 1000)
187-
// setTimeout(_ => {
193+
// app.data.heading = 3
194+
// }, 1000)
195+
// setTimeout(_ => {
188196

189-
// app.data.isH2 = true
190-
// app.data.obj.home.ary[0].name = "Test"
197+
// app.data.isH2 = true
198+
// app.data.obj.home.ary[0].name = "Test"
191199

192-
// }, 2000)
193-
console.log("已渲染")
194-
},
195-
before_update: _ => {
196-
console.log("準備更新")
197-
// alert(true)
198-
// return false;
199-
},
200-
updated: _ => {
201-
console.log("已更新")
200+
// }, 2000)
201+
console.log("已渲染")
202+
},
203+
before_update: _ => {
204+
console.log("準備更新")
205+
// alert(true)
206+
// return false;
207+
},
208+
updated: _ => {
209+
console.log("已更新")
210+
}
202211
}
203212
});
204213
</script>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pdquickui",
3-
"version": "0.2.1",
3+
"version": "0.3.0",
44
"description": "PDQuickUI contains a lightweight front-end framework designed to separate the front-end user interface and data logic.",
55
"main": "dist/PDQuickUI.js",
66
"module": "dist/PDQuickUI.module.js",

src/*.ts

221 Bytes
Binary file not shown.

src/Lifecycle.ts

2.72 KB
Binary file not shown.

src/PDQuickUI.js

10.6 KB
Binary file not shown.

src/QUI.ts

39.6 KB
Binary file not shown.

src/function/printLog.ts

228 Bytes
Binary file not shown.

src/interface.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ interface Window {
22
QUI: any;
33
};
44

5-
interface vDOM {
6-
tag: string;
7-
props: { [key: string]: string };
8-
children: (vDOM | string)[];
9-
data: any;
10-
dismiss: boolean;
11-
};
12-
135
type Patch =
146
| { type: "CREATE"; vdom: vDOM | string; index: number[] }
157
| { type: "APPEND"; vdom: vDOM | string; index: number[] }

0 commit comments

Comments
 (0)