From 53c1299b4d198c41f1684f73c13f8037f67a304b Mon Sep 17 00:00:00 2001 From: Mimi <1119186082@qq.com> Date: Thu, 21 May 2020 09:49:21 +0800 Subject: [PATCH] Update docs for cdnPath --- README.md | 6 +++++- autoload.js | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f5526f3..b406bc8 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,10 @@ https://example.com/path/to/live2d-widget/ ``` 就可以加载了。 +## 后端 API + +`initWidget` 方法接受名为 `apiPath` 和 `cdnPath` 的参数,两者设置其中一项即可。其中 `apiPath` 为后端 API 的 URL,可以自行搭建,并增加模型(需要修改的内容比较多,此处不再赘述)。而 `cdnPath` 则是通过 jsDelivr 这样的 CDN 服务加载资源,更加稳定。 + ## 目录结构 Files - `waifu-tips.js` 包含了按钮和对话框的逻辑; @@ -123,7 +127,7 @@ https://imjad.cn/archives/lab/add-dynamic-poster-girl-with-live2d-to-your-blog-0 https://github.com/xiazeyu/live2d-widget.js https://github.com/summerscar/live2dDemo -还可以自行搭建后端 API,并增加模型(需要修改的内容比较多,此处不再赘述): +关于后端 API 模型: https://github.com/fghrsh/live2d_api https://github.com/xiazeyu/live2d-widget-models https://github.com/xiaoski/live2d_models_collection diff --git a/autoload.js b/autoload.js index f62eaa1..e9ae7e9 100644 --- a/autoload.js +++ b/autoload.js @@ -33,8 +33,8 @@ if (screen.width >= 768) { ]).then(() => { initWidget({ waifuPath: live2d_path + "waifu-tips.json", - apiPath: "https://live2d.fghrsh.net/api/", - //cdnPath: "https://cdn.jsdelivr.net/gh/fghrsh/live2d_api/" + //apiPath: "https://live2d.fghrsh.net/api/", + cdnPath: "https://cdn.jsdelivr.net/gh/fghrsh/live2d_api/" }); }); }