[WordPress] 外掛分享: SC-Vue

首頁外掛目錄 › SC-Vue
40+
安裝啟用
★★★★★
5/5 分(1 則評價)
1748 天前
最後更新
問題解決
WordPress 5.4+ PHP 7.0+ v1.0 上架:2020-05-15

內容簡介

SC-Vue 提供一個短代碼來注入 Vue.js 應用程式
到 WordPress 頁面和文章中。例如,以下短代碼
會注入 'demo_posts' 應用程式:

[pl2010_vue app="demo_posts"/]

一個應用程式由兩個檔案組成,index.js 和 index.html。它們位於
在外掛中 'apps' 目錄下的一個名為應用程式名稱的子目錄下。
對於 'demo_posts' 應用程式,這意味著:

WP_PLUGIN_DIR/sc-vue/apps/demo_posts/index.js
WP_PLUGIN_DIR/sc-vue/apps/demo_posts/index.html

index.js Javascript 檔案設置一個初始化函式,
用於創建 Vue 模型。該模型控制一個 SC-Vue 渲染的 <div> DOM 元素;
該 <div> 的內容來自於 index.html。

參見 apps/demo_01 和 apps/demo_02,這是 index.js
和 index.html 的簡單示例。對於一個更複雜和現實的範例,使用
webpack.js 將 Javascript 和樣式打包成單一個 index.js,請參見 apps/demo_posts。
有關更多詳細信息,請查閱 init.php 中短代碼功能的文件。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「SC-Vue」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

SC-Vue provides a shortcode to inject Vue.js apps
into WordPress pages and posts. For example, the following shortcode
would inject the ‘demo_posts’ app:
[pl2010_vue app="demo_posts"/]

An app is made up of two files, index.js and index.html. They reside
in a subdirectory bearing the app’s name under the ‘apps’ directory
in the plugin. For the ‘demo_posts’ app, that means:

WP_PLUGIN_DIR/sc-vue/apps/demo_posts/index.js
WP_PLUGIN_DIR/sc-vue/apps/demo_posts/index.html

The index.js Javascript file sets up an initialization function for
creating a Vue model. That model controls a

DOM element that
SC-Vue renders; the content of that

comes from index.html.
See apps/demo_01 and apps/demo_02 for simple examples of index.js
and index.html. For a more complex and realistic example that uses
webpack.js to packs Javascript and styles
into a single index.js, see apps/demo_posts. Additional details may
be found in the documentation of the shortcode function in init.php.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon