検索
ホームページウェブフロントエンドjsチュートリアルQuickUI: 軽量フロントエンド フレームワーク

QuickUI: Lightweight Frontend Framework

GitHub

(以前は PDQuickUI として知られていましたが、バージョン 0.6.0 から QuickUI に名前変更されました)

QuickUI は、PDRenderKit から派生したフロントエンド レンダリング フレームワークで、フロントエンド フレームワークの機能の強化に重点を置いています。

仮想 DOM を統合することで、レンダリング ロジックを書き換えてレンダリング効率を向上させ、より高速なデータ観察と自動更新を可能にします。

このプロジェクトは、互換性とパフォーマンスを確保するために PDRenderKit からプロトタイプ拡張機能を削除し、複雑なアプリケーションに適したものにします。

モジュール バージョンと非モジュール バージョンの両方が提供され、ライセンスが PDRenderKit の GPL-3.0 から MIT に変更されます。

特徴

  • 明確なアーキテクチャ: UI をデータ ロジックから分離し、保守を容易にします。
  • コードの簡素化: 冗長なコードを削減し、可読性を高めます。
  • 自動レンダリング: データの変更を監視し、自動的に更新し、手動操作を最小限に抑えます。
  • 軽量: 20kb 未満のファイル サイズ内ですべての機能を維持します。

インストール

  • npm からインストール

    npm i @pardnchiu/quickui
    
  • CDN から含める

    • QuickUI を直接インクルード

      <!-- Version 0.6.0 and above -->
      <script src="https://cdn.jsdelivr.net/npm/@pardnchiu/quickui@%5BVERSION%5D/dist/QuickUI.js"></script>
      
      <!-- Version 0.5.4 and below -->
      <script src="https://cdn.jsdelivr.net/npm/pdquickui@%5BVERSION%5D/dist/PDQuickUI.js"></script>
      
    • モジュールのバージョン

      // Version 0.6.0 and above
      import { QUI } from "https://cdn.jsdelivr.net/npm/@pardnchiu/quickui@[VERSION]/dist/QuickUI.esm.js";
      
      // Version 0.5.4 and below
      import { QUI } from "https://cdn.jsdelivr.net/npm/pdquickui@[VERSION]/dist/PDQuickUI.module.js";
      

使用法

  • QUI を初期化します

    const app = new QUI({
        id: "", // Specify rendering element
        data: {
            // Custom DATA
        },
        event: {
            // Custom EVENT
        },
        when: {
            before_render: function () {
                // Stop rendering
            },
            rendered: function () {
                // Rendered
            },
            before_update: function () {
                // Stop updating
            },
            updated: function () {
                // Updated
            },
            before_destroy: function () {
                // Stop destruction
            },
            destroyed: function () {
                // Destroyed
            }
        }
    });
    

概要

自動レンダリング: データの変更が検出されると、自動的に再ロードされます。

属性の概要

Attribute Description
{{value}} Inserts text into HTML tags and automatically updates with data changes.
:path Used with the temp tag to load HTML fragments from external files into the current page.
:html Replaces the element's innerHTML with text.
:for Supports formats like item in items, (item, index) in items, (key, value) in object. Iterates over data collections to generate corresponding HTML elements.
:if
:else-if
:elif
:else
Displays or hides elements based on specified conditions, enabling branching logic.
:model Binds data to form elements (e.g., input), updating data automatically when input changes.
:hide Hides elements based on specific conditions.
:animation Specifies transition effects for elements, such as fade-in or expand, to enhance user experience.
:mask Controls block loading animations, supporting `true
:[attr] Sets element attributes, such as ID, class, image source, etc.
Examples: :id/:class/:src/:alt/:href...
:[css] Sets element CSS, such as margin, padding, etc. Examples: :background-color, :opacity, :margin, :top, :position...
@[event] Adds event listeners that trigger specified actions upon activation.
Examples: @click/@input/@mousedown...

テキストの置換

{{価値}}

  • index.html

    npm i @pardnchiu/quickui
    
  • 結果

    <!-- Version 0.6.0 and above -->
    <script src="https://cdn.jsdelivr.net/npm/@pardnchiu/quickui@%5BVERSION%5D/dist/QuickUI.js"></script>
    
    <!-- Version 0.5.4 and below -->
    <script src="https://cdn.jsdelivr.net/npm/pdquickui@%5BVERSION%5D/dist/PDQuickUI.js"></script>
    

:html

  • index.html

    // Version 0.6.0 and above
    import { QUI } from "https://cdn.jsdelivr.net/npm/@pardnchiu/quickui@[VERSION]/dist/QuickUI.esm.js";
    
    // Version 0.5.4 and below
    import { QUI } from "https://cdn.jsdelivr.net/npm/pdquickui@[VERSION]/dist/PDQuickUI.module.js";
    
  • 結果

    const app = new QUI({
        id: "", // Specify rendering element
        data: {
            // Custom DATA
        },
        event: {
            // Custom EVENT
        },
        when: {
            before_render: function () {
                // Stop rendering
            },
            rendered: function () {
                // Rendered
            },
            before_update: function () {
                // Stop updating
            },
            updated: function () {
                // Updated
            },
            before_destroy: function () {
                // Stop destruction
            },
            destroyed: function () {
                // Destroyed
            }
        }
    });
    

ブロックを挿入

> [!NOTE]
>テスト時にはブラウザでローカル ファイル制限を無効にするか、ライブ サーバーを使用してください。

:パス

  • test.html

    <h1 id="title">{{ title }}</h1>
    
        const app = new QUI({
            id: "app",
            data: {
                title: "test"
            }
        });
    
    
  • index.html

        <h1 id="test">test</h1>
    
    
  • 結果

        const app = new QUI({
            id: "app",
            data: {
                html: "<b>innerHtml</b>"
            }
        });
    
    

ループレンダリング

:のために

  • index.html

            <b>innerHtml</b>
    
    
  • 結果

    <h1 id="path-heading">path heading</h1>
    <p>path content</p>
    
  • 結果

        const app = new QUI({
            id: "app"
        });
    
    

条件付きレンダリング

  • index.html

        <h1 id="path-heading">path heading</h1>
        <p>path content</p>
    
    
  • 結果: 見出し = 1

        
    • {{ item }} {{ CALC(index + 1) }}
    const app = new QUI({ id: "app", data: { ary: ["test1", "test2", "test3"] } });
  • 結果: 見出し = null && isH2 = true

        

Nest loop

  • index.html

    
    
    • {{ key }}: {{ val.name }}
      • {{ item.name }}
        • {{ CALC(index1 + 1) }}. {{ item1.name }} - ${{ item1.price }}
    const app = new QUI({ id: "app", data: { obj: { food: { name: "Food", ary: [ { name: 'Snacks', ary1: [ { name: 'Potato Chips', price: 10 }, { name: 'Chocolate', price: 8 } ] }, { name: 'Beverages', ary1: [ { name: 'Juice', price: 5 }, { name: 'Tea', price: 3 } ] } ] }, home: { name: 'Home', ary: [ { name: 'Furniture', ary1: [ { name: 'Sofa', price: 300 }, { name: 'Table', price: 150 } ] }, { name: 'Decorations', ary1: [ { name: 'Picture Frame', price: 20 }, { name: 'Vase', price: 15 } ] } ] } } } });
  • 結果: 見出し = 3 && isH2 = null

    
    
    • food: Food
      • Snacks
        • 1. Potato Chips -
        • 2. Chocolate -
      • Beverages
        • 1. Juice -
        • 2. Tea -
    • home: Home
      • Furniture
        • 1. Sofa - 0
        • 2. Table - 0
      • Decorations
        • 1. Picture Frame -
        • 2. Vase -
  • 結果: 見出し = null && isH2 = null

        <h1 id="title-heading">{{ title }} {{ heading }}</h1>
        <h2 id="title-heading">{{ title }} {{ heading }}</h2>
        <h3 id="title-heading">{{ title }} {{ heading }}</h3>
        <h4 id="title-heading">{{ title }} {{ heading }}</h4>
    
        const app = new QUI({
            id: "app",
            data: {
                heading: [Number|null],
                isH2: [Boolean|null],
                title: "test"
            }
        });
    
    

テンプレートのレンダリング

  • index.html

        <h1 id="test">test 1</h1>
    
    
  • 結果

        <h2 id="test">test </h2>
    
    

バインディング

    <h3 id="test">test 3</h3>

イベント

    <h4 id="test">test </h4>

CSS

> [!NOTE]
> :[CSS プロパティ] を使用した簡単な設定をサポートし、データをスタイル属性に直接バインドします。

  • index.html

        const test = new QUI({
            id: "app",
            data: {
                hint: "hint 123",
                title: "test 123"
            },
            render: () => {
                return `
                    "{{ hint }}",
                    h1 {
                        style: "background: red;", 
                        children: [ 
                            "{{ title }}"
                        ]
                    }`
            }
        })
    
    
  • 結果:

        hint 123
        <h1 id="test">test 123</h1>
    
    

機能

長さ()

  • index.html

    
        test
    
    
        const app = new QUI({
            id: "app",
            data: {
                password: null,
            },
            event: {
                show: function(e){
                    alert("Password:", app.data.password);
                }
            }
        });
    
    
  • 結果

        test
    
    
        const app = new QUI({
            id: "app",
            event: {
                test: function(e){
                    alert(e.target.innerText + " clicked");
                }
            }
        });
    
    

計算()

  • index.html

        test
    
        const app = new QUI({
            id: "app",
            data: {
                width: "100px",
                color: "red"
            }
        });
    
    
  • 結果

        test
    
    

アッパー() / ロアー()

  • index.html

        <p>Total: {{ LENGTH(array) }}</p>
    
        const app = new QUI({
            id: "app",
            data: {
                array: [1, 2, 3, 4]
            }
        });
    
    
  • 結果

        <p>Total: 4</p>
    
    

DATE(数値、形式)

  • index.html

        <p>calc: {{ CALC(num * 10) }}</p>
    
        const app = new QUI({
            id: "app",
            data: {
                num: 1
            }
        });
    
    
  • 結果

        <p>calc: 10</p>
    
    

レイジーロード

:lazyload

  • index.html

        <p>{{ UPPER(test1) }} {{ LOWER(test2) }}</p>
    
        const app = new QUI({
            id: "app",
            data: {
                test1: "upper",
                test2: "LOWER"
            }
        });
    
    
  • 結果

        <p>UPPER lower</p>
    
    

SVGの置換

  • テスト.svg

        <p>{{ DATE(now, YYYY-MM-DD hh:mm:ss) }}</p>
    
        const app = new QUI({
            id: "app",
            data: {
                now: Math.floor(Date.now() / 1000)
            }
        });
    
    
  • index.html

        <p>2024-08-17 03:40:47</p>
    
    
  • 結果

        <img  src="/static/imghwm/default1.png" data-src="test.jpg" class="lazy" alt="QuickUI: 軽量フロントエンド フレームワーク" >
    
        const app = new QUI({
            id: "app",
            data: {
                image: "test.jpg"
            },
            option: {
                lazyload: true // Enable image lazy loading: true|false (default: true)
            }
        });
    
    

i18n

> [!NOTE]
>形式がオブジェクトの場合、多言語コンテンツが直接設定されます。
>形式が文字列の場合、言語ファイルはフェッチを通じて動的にロードされます。

  • en.json

        <img  src="/static/imghwm/default1.png" data-src="test.jpg" class="lazy" alt="QuickUI: 軽量フロントエンド フレームワーク" >
    
    
  • index.html

    
    
  • 結果 i18nLang = zh

        const app = new QUI({
            id: "app",
            data: {
                svg: "test.svg",
            },
            option: {
                svg: true  // Enable SVG file transformation: true|false (default: true)
            }
        });
    
    
  • 結果 i18nLang = en

    
    

ライフサイクルフック

{
    "greeting": "Hello",
    "username": "Username"
}

データの取得

npm i @pardnchiu/quickui

クリエイター

邱敬幃 Pardn Chiu

ライセンス

このプロジェクトは、独自のライセンスに基づいてライセンスされています。

このソフトウェアは、エンドユーザー使用許諾契約 (EULA) に指定されている条件に基づいてのみ使用、インストール、実行できます。


©️ 2024 邱敬幃 Pardn Chiu

以上がQuickUI: 軽量フロントエンド フレームワークの詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
JavaScriptのコア:CまたはCの上に構築されていますか?JavaScriptのコア:CまたはCの上に構築されていますか?May 05, 2025 am 12:07 AM

javascriptisnotbuiltoncorc;それは、解釈されていることを解釈しました。

JavaScriptアプリケーション:フロントエンドからバックエンドまでJavaScriptアプリケーション:フロントエンドからバックエンドまでMay 04, 2025 am 12:12 AM

JavaScriptは、フロントエンドおよびバックエンド開発に使用できます。フロントエンドは、DOM操作を介してユーザーエクスペリエンスを強化し、バックエンドはnode.jsを介してサーバータスクを処理することを処理します。 1.フロントエンドの例:Webページテキストのコンテンツを変更します。 2。バックエンドの例:node.jsサーバーを作成します。

Python vs. Javascript:どの言語を学ぶべきですか?Python vs. Javascript:どの言語を学ぶべきですか?May 03, 2025 am 12:10 AM

PythonまたはJavaScriptの選択は、キャリア開発、学習曲線、エコシステムに基づいている必要があります。1)キャリア開発:Pythonはデータサイエンスとバックエンド開発に適していますが、JavaScriptはフロントエンドおよびフルスタック開発に適しています。 2)学習曲線:Python構文は簡潔で初心者に適しています。 JavaScriptの構文は柔軟です。 3)エコシステム:Pythonには豊富な科学コンピューティングライブラリがあり、JavaScriptには強力なフロントエンドフレームワークがあります。

JavaScriptフレームワーク:最新のWeb開発のパワーJavaScriptフレームワーク:最新のWeb開発のパワーMay 02, 2025 am 12:04 AM

JavaScriptフレームワークのパワーは、開発を簡素化し、ユーザーエクスペリエンスとアプリケーションのパフォーマンスを向上させることにあります。フレームワークを選択するときは、次のことを検討してください。1。プロジェクトのサイズと複雑さ、2。チームエクスペリエンス、3。エコシステムとコミュニティサポート。

JavaScript、C、およびブラウザの関係JavaScript、C、およびブラウザの関係May 01, 2025 am 12:06 AM

はじめに私はあなたがそれを奇妙に思うかもしれないことを知っています、JavaScript、C、およびブラウザは正確に何をしなければなりませんか?彼らは無関係であるように見えますが、実際、彼らは現代のウェブ開発において非常に重要な役割を果たしています。今日は、これら3つの間の密接なつながりについて説明します。この記事を通して、JavaScriptがブラウザでどのように実行されるか、ブラウザエンジンでのCの役割、およびそれらが協力してWebページのレンダリングと相互作用を駆動する方法を学びます。私たちは皆、JavaScriptとブラウザの関係を知っています。 JavaScriptは、フロントエンド開発のコア言語です。ブラウザで直接実行され、Webページが鮮明で興味深いものになります。なぜJavascrを疑問に思ったことがありますか

node.jsは、型を使用してストリーミングしますnode.jsは、型を使用してストリーミングしますApr 30, 2025 am 08:22 AM

node.jsは、主にストリームのおかげで、効率的なI/Oで優れています。 ストリームはデータを段階的に処理し、メモリの過負荷を回避します。大きなファイル、ネットワークタスク、リアルタイムアプリケーションの場合。ストリームとTypeScriptのタイプの安全性を組み合わせることで、パワーが作成されます

Python vs. JavaScript:パフォーマンスと効率の考慮事項Python vs. JavaScript:パフォーマンスと効率の考慮事項Apr 30, 2025 am 12:08 AM

PythonとJavaScriptのパフォーマンスと効率の違いは、主に以下に反映されています。1)解釈された言語として、Pythonはゆっくりと実行されますが、開発効率が高く、迅速なプロトタイプ開発に適しています。 2)JavaScriptはブラウザ内の単一のスレッドに限定されていますが、マルチスレッドおよび非同期I/Oを使用してnode.jsのパフォーマンスを改善でき、両方とも実際のプロジェクトで利点があります。

JavaScriptの起源:その実装言語の調査JavaScriptの起源:その実装言語の調査Apr 29, 2025 am 12:51 AM

JavaScriptは1995年に発信され、Brandon Ikeによって作成され、言語をCに実現しました。 2。JavaScriptのメモリ管理とパフォーマンスの最適化は、C言語に依存しています。 3. C言語のクロスプラットフォーム機能は、さまざまなオペレーティングシステムでJavaScriptを効率的に実行するのに役立ちます。

See all articles

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

Video Face Swap

Video Face Swap

完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

ホットツール

AtomエディタMac版ダウンロード

AtomエディタMac版ダウンロード

最も人気のあるオープンソースエディター

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)

PhpStorm Mac バージョン

PhpStorm Mac バージョン

最新(2018.2.1)のプロフェッショナル向けPHP統合開発ツール

MantisBT

MantisBT

Mantis は、製品の欠陥追跡を支援するために設計された、導入が簡単な Web ベースの欠陥追跡ツールです。 PHP、MySQL、Web サーバーが必要です。デモおよびホスティング サービスをチェックしてください。

mPDF

mPDF

mPDF は、UTF-8 でエンコードされた HTML から PDF ファイルを生成できる PHP ライブラリです。オリジナルの作者である Ian Back は、Web サイトから「オンザフライ」で PDF ファイルを出力し、さまざまな言語を処理するために mPDF を作成しました。 HTML2FPDF などのオリジナルのスクリプトよりも遅く、Unicode フォントを使用すると生成されるファイルが大きくなりますが、CSS スタイルなどをサポートし、多くの機能強化が施されています。 RTL (アラビア語とヘブライ語) や CJK (中国語、日本語、韓国語) を含むほぼすべての言語をサポートします。ネストされたブロックレベル要素 (P、DIV など) をサポートします。