Skip to content

Commit 89861d8

Browse files
committed
:lazyload 添加跨域處理,修正差異算法確保元素屬性可以被正確移除。
1 parent 295e645 commit 89861d8

File tree

14 files changed

+26
-22
lines changed

14 files changed

+26
-22
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,19 @@ const app = new QUI({
8383
// Custom EVENT
8484
},
8585
when: {
86-
before_render: function () {
86+
beforeRender: function () {
8787
// Stop rendering
8888
},
8989
rendered: function () {
9090
// Rendered
9191
},
92-
before_update: function () {
92+
beforeUpdate: function () {
9393
// Stop updating
9494
},
9595
updated: function () {
9696
// Updated
9797
},
98-
before_destroy: function () {
98+
beforeDestroy: function () {
9999
// Stop destruction
100100
},
101101
destroyed: function () {

README.zh.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,19 @@ const app = new QUI({
8383
// 自訂 EVENT
8484
},
8585
when: {
86-
before_render: function () {
86+
beforeRender: function () {
8787
// 停止渲染
8888
},
8989
rendered: function () {
9090
// 已渲染
9191
},
92-
before_update: function () {
92+
beforeUpdate: function () {
9393
// 停止更新
9494
},
9595
updated: function () {
9696
// 已更新
9797
},
98-
before_destroy: function () {
98+
beforeDestroy: function () {
9999
// 停止銷毀
100100
},
101101
destroyed: function () {

dist/QuickUI.esm.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/QuickUI.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.

package.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
{
22
"name": "@pardnchiu/quickui",
3-
"version": "0.6.7",
3+
"version": "0.6.8",
44
"description": "QuickUI is a lightweight frontend framework built on pure JavaScript and native APIs. Supports data binding, i18n support, event binding, conditional rendering, and loop rendering.",
55
"main": "dist/QuickUI.js",
66
"module": "dist/QuickUI.esm.js",
77
"types": "src/interface.ts",
88
"scripts": {
9-
"minify": "npx terser src/*.js -c -m -o dist/QuickUI.js --config-file terser.config.json --name-cache terser.cache.json && npx terser src/*.js -c -m -o dist/QuickUI.esm.js --config-file terser.config.json --name-cache terser.cache.json && echo 'export const QUI = window.QUI;' >> dist/QuickUI.esm.js",
10-
"minify-w": "chokidar 'src/QuickUI.js' -c 'npm run minify'",
11-
"sass": "sass src/sass:dist/ -w --style compressed --no-source-map",
12-
"sass-index": "sass static/sass/:static/css/ -w --style compressed --no-source-map"
9+
"build:debug": "tsc",
10+
"build:min": "npx terser src/QuickUI.debug.js -c -m -o dist/QuickUI.js --config-file terser.config.json",
11+
"build:esm": "npx terser src/QuickUI.debug.js -c -m -o dist/QuickUI.esm.js --config-file terser.config.json && echo 'export const QUI = window.QUI;' >> dist/QuickUI.esm.js",
12+
"build:once": "npm run build:debug && npm-run-all build:min build:esm",
13+
"build": "chokidar src/QuickUI.debug.js -c 'npm-run-all build:min build:esm'",
14+
"sass:library": "sass src/sass:dist/ -w --style compressed --no-source-map",
15+
"sass:index": "sass static/sass/:static/css/ -w --style compressed --no-source-map",
16+
"sass": "npm-run-all sass:library sass:index"
1317
},
1418
"publishConfig": {
1519
"access": "public"

page/doc.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@
457457
<button @click="changeContent" data-title="data">{{ i18n.data }}</button>
458458
<button @click="changeContent" data-title="DEPRECATION">{{ i18n.DEPRECATION }}</button>
459459
</section>
460-
<section id="doc-body-content" class="body"></section>
460+
<section id="doc-body-content" class="body" style="padding-top: 1.5rem"></section>
461461
</section>
462462
<!-- -->
463463
<footer>

page/test.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@
6464

6565
<!-- 本地資源 -->
6666
<!-- <script type="module" src="/static/js/index.js"></script> -->
67-
<script src="/dist/QuickUI.js"></script>
67+
<script src="/src/QuickUI.debug.js"></script>
6868
</head>
6969

70-
<body id="app" :effect="fade-in">
70+
<body id="app">
7171
<p @click="click">i18n</p>
7272
<p :test="i18n.greeting">{{ i18n.greeting }}, {{ i18n.user }}: {{ username }}</p>
7373
<section :html="html"></section>
@@ -126,13 +126,13 @@ <h4 :else>{{ title }} 4
126126
<script>
127127
document.addEventListener("DOMContentLoaded", () => {
128128
let icons = "ableton,activitypub,actix,adonis,ae,aiscript,alpinejs,anaconda,androidstudio,angular,ansible,apollo,apple,appwrite,arch,arduino,astro,atom,au,autocad,aws,azul,azure,babel,bash,bevy,bitbucket,blender,bootstrap,bsd,bun,c,cs,cpp,crystal,cassandra,clion,clojure,cloudflare,cmake,codepen,coffeescript,css,cypress,d3,dart,debian,deno,devto,discord,bots,discordjs,django,docker,dotnet,dynamodb,eclipse,elasticsearch,electron,elixir,elysia,emacs,ember,emotion,express,fastapi,fediverse,figma,firebase,flask,flutter,forth,fortran,gamemakerstudio,gatsby,gcp,git,github,githubactions,gitlab,gmail,gherkin,go,gradle,godot,grafana,graphql,gtk,gulp,haskell,haxe,haxeflixel,heroku,hibernate,html,htmx,idea,ai,instagram,ipfs,java,js,jenkins,jest,jquery,kafka,kali,kotlin,ktor,kubernetes,laravel,latex,less,linkedin,linux,lit,lua,md,mastodon,materialui,matlab,maven,mint,misskey,mongodb,mysql,neovim,nestjs,netlify,nextjs,nginx,nim,nix,nodejs,notion,npm,nuxtjs,obsidian,ocaml,octave,opencv,openshift,openstack,p5js,perl,ps,php,phpstorm,pinia,pkl,plan9,planetscale,pnpm,postgres,postman,powershell,pr,prisma,processing,prometheus,pug,pycharm,py,pytorch,qt,r,rabbitmq,rails,raspberrypi,react,reactivex,redhat,redis,redux,regex,remix,replit,rider,robloxstudio,rocket,rollupjs,ros,ruby,rust,sass,spring,sqlite,stackoverflow,styledcomponents,sublime,supabase,scala,sklearn,selenium,sentry,sequelize,sketchup,solidity,solidjs,svelte,svg,swift,symfony,tailwind,tauri,tensorflow,terraform,threejs,twitter,ts,ubuntu,unity,unreal,v,vala,vercel,vim,visualstudio,vite,vitest,vscode,vscodium,vue,vuetify,wasm,webflow,webpack,webstorm,windicss,windows,wordpress,workers,xd,yarn,yew,zig".split(",");
129+
129130
const test = new QUI({
130131
id: "test",
131132
data: {
132133
test: "test 123"
133134
},
134-
render: () => {
135-
return `
135+
render: _ => `
136136
"{{ test }}",
137137
div#main-card.primary.highlighted {
138138
style: "background: red;",
@@ -146,7 +146,6 @@ <h4 :else>{{ title }} 4
146146
}
147147
]
148148
}`
149-
}
150149
})
151150

152151
const app = new QUI({
@@ -238,7 +237,7 @@ <h4 :else>{{ title }} 4
238237
}
239238
},
240239
when: {
241-
before_render: _ => {
240+
beforeRender: _ => {
242241
console.log("準備渲染");
243242
// return false;
244243
},
@@ -271,7 +270,7 @@ <h4 :else>{{ title }} 4
271270
}, 2000)
272271
console.log("已渲染")
273272
},
274-
before_update: _ => {
273+
beforeUpdate: _ => {
275274
console.log("準備更新")
276275
// alert(true)
277276
// return false;
@@ -281,6 +280,7 @@ <h4 :else>{{ title }} 4
281280
}
282281
}
283282
});
283+
284284
});
285285
</script>
286286
</body>

src/QuickUI.debug.js

87.2 KB
Binary file not shown.

src/QuickUI.js

-86.5 KB
Binary file not shown.

src/function/check200.ts

370 Bytes
Binary file not shown.

src/listener/LazyloadListener.ts

259 Bytes
Binary file not shown.

src/model/QUI.ts

143 Bytes
Binary file not shown.

src/model/vDOM.ts

-7 Bytes
Binary file not shown.

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
5050
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
5151
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
52-
"outFile": "./src/QuickUI.js", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
52+
"outFile": "./src/QuickUI.debug.js", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
5353
// "outDir": "./dist", /* Specify an output folder for all emitted files. */
5454
// "removeComments": true, /* Disable emitting comments. */
5555
// "noEmit": true, /* Disable emitting files from a compilation. */

0 commit comments

Comments
 (0)