效果
AI智能體 微信小程序 流式
1.安裝Node.js
參考:2024最新版Node.js下載安裝及環境配置教程(非常詳細)_node.js 安裝-CSDN博客
2.需要克隆項目到本地或直接到項目地址下載壓縮包。
?參考:uniapp中解析markdown支持網頁和小程序_uniapp markdown-CSDN博客
git clone https://github.com/sbfkcel/towxml.git
3.安裝依賴后在本地執行build編譯代碼
npm install
npm run build
4. 在dist目錄下,把文件夾dist改名為towxml,在uni-app項目根目錄中新建wxcomponents目錄,將towxml復制進去。
5.在towxml/decode.json中修改路徑
6.在需要使用的頁面pages.json
中添加組件配置,引入towxml
組件
{"path": "pages/page/page","style": {"usingComponents": {"towxml": "/wxcomponents/towxml/towxml"}
}
7.在需要頁面加入下面代碼
?
const towxml = require("../wxcomponents/towxml/index.js");<towxml ?v-if="msg.html" :nodes="msg.html" />"globalStyle": {"navigationBarTextStyle": "white","navigationBarTitleText": "牛小智","navigationBarBackgroundColor": "#00aa7f","backgroundColor": "#ffffff",// #ifdef MP-WEIXIN"usingComponents": {"towxml": "/wxcomponents/towxml/towxml","decode": "/wxcomponents/towxml/decode"}// #endif},