
語言 🇹🇼 繁體中文
文件
快速開始
使用方式
Add Comments to Your React App
這是 FastComments 的官方 React 函式庫。
在你的 React 應用程式中嵌入即時評論、聊天和審閱小工具。
儲存庫
即時示範 
在 https://fastcomments.com/commenting-system-for-react 線上試用每個小工具。
線上展示 
要在本機查看針對公開 demo 租戶運行的所有 widget 和 flow,請克隆該儲存庫並執行:
cd examples/example-showcase
npm install
npm start
每個 widget/flow 在 examples/example-showcase/src/views/ 底下都有自己的視圖,你可以直接將它們複製到你自己的 React 應用程式中。
使用方式 
The Main Widget Component
FastCommentsCommentWidget 元件包含即時的 FastComments 留言小工具。
將下方的 "demo" 替換為您的 "tenantId" - 可在 FastComments 管理後台的 這裡 取得。
此小工具支援許多選項 - 請參閱 src/index.tsx 中的 FastCommentsCommentWidgetConfig。
import React, { Component } from 'react'
import {FastCommentsCommentWidget} from 'fastcomments-react'
class Example extends Component {
render() {
return <FastCommentsCommentWidget tenantId="demo" />
}
}
Updating The Current Page (For SPAs)
若要更新留言串所綁定的頁面/文章,您必須更新設定參數 "urlId" 與 "url"。 範例與說明請見 這裡。
Account Region (ATTENTION: EU Customers)
如果您位於歐盟,您會想要告知用戶端小工具您所在的區域。請參閱 examples/example-eu;
否則,您不需要定義 region。
The Comment Count Widget
FastCommentsCommentCountWidget 元件包含即時的 FastComments 留言數量小工具。
將下方的 "demo" 替換為您的 "tenantId" - 可在 FastComments 管理後台的 這裡 取得。
支援的設定選項請參閱 src/index.tsx 中的 FastCommentsCommentCountConfig。
import React, { Component } from 'react'
import {FastCommentsCommentCountWidget} from 'fastcomments-react'
class Example extends Component {
render() {
return <FastCommentsCommentCountWidget tenantId="demo" urlId="https://example.com/some-page-or-id" />
}
}
Native
如需完全原生實作的 FastComments,請參閱 fastcomments-react-native-sdk。
如需以 webview 包裝此函式庫的 React Native 外層,請參閱 fastcomments-react-native.
維護狀態 
這些元件是我們核心 VanillaJS 元件的封裝器。我們可以自動更新這些元件(修正錯誤、加入功能)而無需發佈本函式庫,因此即使它可能會有一段時間沒有發佈,也不代表 FastComments 並未積極開發中!歡迎隨時查看 我們的部落格 以獲得更新。任何會破壞相容性的 API 變更或功能,都不會在未提高本函式庫版本號的情況下釋出到底層核心函式庫。
需要協助?
如果您在使用 React 函式庫時遇到任何問題或對其有疑問,請:
貢獻
歡迎各種貢獻!請造訪 GitHub 倉庫 以取得貢獻指南。