Skip to content

Commit 4a02e74

Browse files
committed
docs(README): 添加快速开始指南
- 创建项目和安装依赖- 配置插件 - 编写脚本插件- 加载和测试插件
1 parent b96f5b7 commit 4a02e74

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

assists-web-simple/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,54 @@
3232
打开[AssistsX](https://www.pgyer.com/SqGaCx8C),点击立即安装,选择**扫描局域网**,点击对应扫描到插件的 **+** 号即可完成插件添加
3333

3434
<img src="https://github.com/user-attachments/assets/d0f24763-266e-4e3c-bd64-a63be9e6c68c" width="250"/>
35+
36+
# 快速开始
37+
## 1. 创建项目
38+
- 创建vite模版项目`npm create vite@latest assistsx-helloword -- --template vue`
39+
- 安装assistsx依赖`npm install assistsx@latest`
40+
## 2. 创建插件配置
41+
在目录`public`下创建文件`assistsx_plugin_config.json`文件,将以下`json`复制粘贴到文件中
42+
```
43+
{
44+
"name": "AssistsX示例",
45+
"version": "1.0.0",
46+
"description": "AssistsX示例",
47+
"isShowOverlay": true,
48+
"needScreenCapture": true,
49+
"packageName": "com.assistsx.example",
50+
"main": "index.html",
51+
"icon": "vite.svg",
52+
"overlayTitle": "AssistsX示例"
53+
}
54+
```
55+
## 3. 编写脚本插件
56+
写一个最简单的,点击微信搜索进入搜索页面
57+
```agsl
58+
const handleClick = () => {
59+
AssistsX.findById("com.tencent.mm:id/jha")[0].click()
60+
}
61+
```
62+
63+
增加一个测试按钮调用这个方法
64+
```agsl
65+
<button type="button" @click="handleClick">测试按钮</button>
66+
```
67+
68+
## 4. 加载插件
69+
1. 我们使用局域网加载插件,加载插件前需要配置项目允许局域网访问,在文件`vite.config.js`添加以下配置
70+
```
71+
export default defineConfig({
72+
plugins: [vue()],
73+
server: {
74+
host: '0.0.0.0', // 允许局域网访问
75+
port: 5173
76+
},
77+
})
78+
```
79+
2. 打开AssistsX,扫描局域网插件添加
80+
81+
<img src="https://github.com/user-attachments/assets/d0f24763-266e-4e3c-bd64-a63be9e6c68c" width="250"/>
82+
83+
3. 测试插件:点击开始,打开微信消息列表,点击测试按钮
84+
85+
<img src="https://github.com/user-attachments/assets/e6e59149-ed78-42de-81a7-c3476b5472e6" width="250"/>

0 commit comments

Comments
 (0)