m8-mcp-server 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -0
- package/bin/m8-mcp.js +2 -0
- package/dist/constants.js +1 -0
- package/dist/data/ejs-doc/api_audio/api_audio.md +225 -0
- package/dist/data/ejs-doc/api_auth/api_auth.md +256 -0
- package/dist/data/ejs-doc/api_contact/api_contact.md +295 -0
- package/dist/data/ejs-doc/api_contact/images/component_contact.jpg +0 -0
- package/dist/data/ejs-doc/api_device/api_device.md +761 -0
- package/dist/data/ejs-doc/api_event/api_event.md +244 -0
- package/dist/data/ejs-doc/api_global/api_global.md +440 -0
- package/dist/data/ejs-doc/api_io/api_io.md +369 -0
- package/dist/data/ejs-doc/api_navigator/api_navigator.md +654 -0
- package/dist/data/ejs-doc/api_navigator/images/navigator.backbtn.png +0 -0
- package/dist/data/ejs-doc/api_navigator/images/navigator.hide.png +0 -0
- package/dist/data/ejs-doc/api_navigator/images/navigator.hidestatus.png +0 -0
- package/dist/data/ejs-doc/api_navigator/images/navigator.leftarrowbtn.jpg +0 -0
- package/dist/data/ejs-doc/api_navigator/images/navigator.leftbtn.png +0 -0
- package/dist/data/ejs-doc/api_navigator/images/navigator.leftbtnimg.png +0 -0
- package/dist/data/ejs-doc/api_navigator/images/navigator.multititle.jpg +0 -0
- package/dist/data/ejs-doc/api_navigator/images/navigator.rightbtn.png +0 -0
- package/dist/data/ejs-doc/api_navigator/images/navigator.rightbtn2.png +0 -0
- package/dist/data/ejs-doc/api_navigator/images/navigator.rightbtnimg.png +0 -0
- package/dist/data/ejs-doc/api_navigator/images/navigator.rightbtnimg2.png +0 -0
- package/dist/data/ejs-doc/api_navigator/images/navigator.rightmenu.png +0 -0
- package/dist/data/ejs-doc/api_navigator/images/navigator.searchbar.png +0 -0
- package/dist/data/ejs-doc/api_navigator/images/navigator.subtitle.jpg +0 -0
- package/dist/data/ejs-doc/api_navigator/images/navigator.title.png +0 -0
- package/dist/data/ejs-doc/api_page/api_page.md +261 -0
- package/dist/data/ejs-doc/api_runtime/api_runtime.md +788 -0
- package/dist/data/ejs-doc/api_storage/api_storage.md +320 -0
- package/dist/data/ejs-doc/api_stream/api_stream.md +152 -0
- package/dist/data/ejs-doc/api_stream/images/body_multiform.jpg +0 -0
- package/dist/data/ejs-doc/api_ui/api_ui.md +836 -0
- package/dist/data/ejs-doc/api_ui/images/ui.popwindow.png +0 -0
- package/dist/data/ejs-doc/api_ui/images/ui_actionsheet.png +0 -0
- package/dist/data/ejs-doc/api_ui/images/ui_alert.png +0 -0
- package/dist/data/ejs-doc/api_ui/images/ui_confirm.png +0 -0
- package/dist/data/ejs-doc/api_ui/images/ui_pickDateTime.png +0 -0
- package/dist/data/ejs-doc/api_ui/images/ui_pickdate.png +0 -0
- package/dist/data/ejs-doc/api_ui/images/ui_pickmonth.png +0 -0
- package/dist/data/ejs-doc/api_ui/images/ui_picktime.png +0 -0
- package/dist/data/ejs-doc/api_ui/images/ui_poppicker.png +0 -0
- package/dist/data/ejs-doc/api_ui/images/ui_poppicker2.png +0 -0
- package/dist/data/ejs-doc/api_ui/images/ui_poppicker3.png +0 -0
- package/dist/data/ejs-doc/api_ui/images/ui_prompt.png +0 -0
- package/dist/data/ejs-doc/api_ui/images/ui_select.png +0 -0
- package/dist/data/ejs-doc/api_ui/images/ui_select2.png +0 -0
- package/dist/data/ejs-doc/api_ui/images/ui_select3.png +0 -0
- package/dist/data/ejs-doc/api_ui/images/ui_showdebugdialog.png +0 -0
- package/dist/data/ejs-doc/api_ui/images/ui_showwaiting.png +0 -0
- package/dist/data/ejs-doc/api_ui/images/ui_toast.png +0 -0
- package/dist/data/ejs-doc/api_ui/images/ui_toastAndEvent.png +0 -0
- package/dist/data/ejs-doc/api_util/api_util.md +615 -0
- package/dist/data/ejs-doc/api_util/images/util.playvideo.png +0 -0
- package/dist/data/ejs-doc/api_util/images/util.previmage.png +0 -0
- package/dist/data/ejs-doc/api_util/images/util.selectfile.png +0 -0
- package/dist/data/ejs-doc/api_util/images/util.selectimage.png +0 -0
- package/dist/data/m8mpdoc-develop/003-/345/205/270/345/236/213/346/241/210/344/276/213/003-/345/210/227/350/241/250/350/257/246/346/203/205.md +247 -0
- package/dist/data/m8mpdoc-develop/003-/345/205/270/345/236/213/346/241/210/344/276/213/003-/345/210/227/350/241/250/350/257/246/346/203/205vue3.md +276 -0
- package/dist/data/m8mpdoc-develop/003-/345/205/270/345/236/213/346/241/210/344/276/213/003-/350/241/250/345/215/225/346/217/220/344/272/244.md +130 -0
- package/dist/data/m8mpdoc-develop/003-/345/205/270/345/236/213/346/241/210/344/276/213/003-/350/241/250/345/215/225/346/217/220/344/272/244vue3.md +115 -0
- package/dist/data/m8mpdoc-develop/005-/346/240/270/345/277/203/351/200/232/347/224/250Util/000-/346/240/270/345/277/203/346/226/271/346/263/225.md +398 -0
- package/dist/data/m8mpdoc-develop/005-/346/240/270/345/277/203/351/200/232/347/224/250Util/001-Ajax/344/270/216/346/226/207/344/273/266/344/270/212/344/274/240.md +456 -0
- package/dist/data/m8mpdoc-develop/006-Util/345/267/245/345/205/267/351/233/206/000-charset.md +128 -0
- package/dist/data/m8mpdoc-develop/006-Util/345/267/245/345/205/267/351/233/206/001-base64.md +142 -0
- package/dist/data/m8mpdoc-develop/006-Util/345/267/245/345/205/267/351/233/206/002-date.md +210 -0
- package/dist/data/m8mpdoc-develop/006-Util/345/267/245/345/205/267/351/233/206/004-math.md +85 -0
- package/dist/data/m8mpdoc-develop/006-Util/345/267/245/345/205/267/351/233/206/006-sha1.md +21 -0
- package/dist/data/m8mpdoc-develop/006-Util/345/267/245/345/205/267/351/233/206/007-sha256.md +36 -0
- package/dist/data/m8mpdoc-develop/006-Util/345/267/245/345/205/267/351/233/206/008-storage.md +128 -0
- package/dist/data/m8mpdoc-develop/006-Util/345/267/245/345/205/267/351/233/206/009-string.md +148 -0
- package/dist/data/m8mpdoc-develop/006-Util/345/267/245/345/205/267/351/233/206/010-Util/346/211/251/345/261/225/346/214/207/345/215/227.md +76 -0
- package/dist/data/m8mpdoc-develop/006-Util/345/267/245/345/205/267/351/233/206/011-cookie.md +59 -0
- package/dist/data/m8mpdoc-develop/006-Util/345/267/245/345/205/267/351/233/206/012-util-sm.md +95 -0
- package/dist/data/m8mpdoc-develop/006-Util/345/267/245/345/205/267/351/233/206/013-1.baseapi.md +76 -0
- package/dist/data/m8mpdoc-develop/006-Util/345/267/245/345/205/267/351/233/206/013-2.network.md +202 -0
- package/dist/data/m8mpdoc-develop/006-Util/345/267/245/345/205/267/351/233/206/013-2.socketTask.md +92 -0
- package/dist/data/m8mpdoc-develop/006-Util/345/267/245/345/205/267/351/233/206/013-3.uiapi.md +412 -0
- package/dist/data/m8mpdoc-develop/006-Util/345/267/245/345/205/267/351/233/206/013-4.eventapi.md +146 -0
- package/dist/data/m8mpdoc-develop/006-Util/345/267/245/345/205/267/351/233/206/013-5.otherapi.md +137 -0
- package/dist/data/m8mpdoc-develop/006-Util/345/267/245/345/205/267/351/233/206/014-util-mpVerifyManager.md +363 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/000-/347/273/204/344/273/266/345/272/223/344/270/213/350/275/275/344/275/277/347/224/250.md +188 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/001-actionsheet/345/212/250/344/275/234/351/235/242/346/235/277.md +460 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/004-amap/345/234/260/345/233/276.md +285 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/005-button/346/214/211/351/222/256.md +211 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/008-cell/345/215/225/345/205/203/346/240/274.md +213 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/009-checkbox/345/244/215/351/200/211/346/241/206.md +501 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/010-circle/347/216/257/345/275/242/350/277/233/345/272/246/346/235/241.md +168 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/011-datepicker/346/227/245/346/234/237/351/200/211/346/213/251.md +617 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/013-field/350/276/223/345/205/245/346/241/206.md +539 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/015-form/350/241/250/345/215/225.md +999 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/018-header/345/244/264/351/203/250/345/257/274/350/210/252/346/240/217.md +150 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/019-icon/345/233/276/346/240/207.md +133 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/020-loading/345/212/240/350/275/275.md +117 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/021-noticebar/351/200/232/347/237/245/346/240/217.md +152 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/022-numberkeyboard/346/225/260/345/255/227/351/224/256/347/233/230.md +427 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/023-pagination/345/210/206/351/241/265.md +212 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/024-panel/351/235/242/346/235/277.md +85 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/025-passwordinput/345/257/206/347/240/201/350/276/223/345/205/245/346/241/206.md +175 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/026-picker/351/200/211/346/213/251/345/231/250.md +519 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/027-popup/345/274/271/345/207/272/345/261/202.md +152 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/028-progress/350/277/233/345/272/246/346/235/241.md +103 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/029-radio/345/215/225/351/200/211/346/241/206.md +285 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/030-rate/350/257/204/345/210/206.md +189 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/031-search/346/220/234/347/264/242.md +217 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/032-slider/346/273/221/345/235/227.md +166 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/033-stepper/346/255/245/350/277/233/345/231/250.md +340 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/035-swipecell/346/273/221/345/212/250/345/215/225/345/205/203/346/240/274.md +265 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/036-switch/345/274/200/345/205/263.md +196 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/037-switchcell/345/274/200/345/205/263/345/215/225/345/205/203/346/240/274.md +115 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/038-tag/346/240/207/350/256/260.md +232 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/039-treeselect/345/210/206/347/261/273/351/200/211/346/213/251.md +631 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/040-uploader/346/226/207/344/273/266/344/270/212/344/274/240.md +531 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/041-verifycode/351/252/214/350/257/201/347/240/201.md +111 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/042-minirefresh/344/270/213/346/213/211/345/210/267/346/226/260.md +337 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/043-layout/345/270/203/345/261/200.md +150 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/044-image/345/233/276/347/211/207.md +144 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/045-toast/350/275/273/346/217/220/347/244/272.md +429 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/046-calendar/346/227/245/345/216/206.md +467 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/047-area/347/234/201/345/270/202/345/214/272/351/200/211/346/213/251.md +295 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/048-tab/346/240/207/347/255/276/351/241/265.md +577 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/049-dialog/345/274/271/345/207/272/346/241/206.md +491 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/050-dropdownmenu/344/270/213/346/213/211/350/217/234/345/215/225.md +265 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/051-notify/346/266/210/346/201/257/351/200/232/347/237/245.md +203 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/052-overlay/351/201/256/347/275/251/345/261/202.md +139 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/053-collapse/346/212/230/345/217/240/351/235/242/346/235/277.md +199 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/054-grid/345/256/253/346/240/274.md +183 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/055-countdown/345/200/222/350/256/241/346/227/266.md +289 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/056-divider/345/210/206/345/211/262/347/272/277.md +97 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/057-empty/347/251/272/347/212/266/346/200/201.md +146 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/058-imagepreview/345/233/276/347/211/207/351/242/204/350/247/210.md +292 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/059-lazyload/346/207/222/345/212/240/350/275/275.md +120 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/060-skeleton/351/252/250/346/236/266/345/261/217.md +114 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/061-steps/346/255/245/351/252/244/346/235/241.md +119 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/062-sticky/347/262/230/346/200/247/345/270/203/345/261/200.md +208 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/063-indexbar/347/264/242/345/274/225/346/240/217.md +161 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/064-sidebar/344/276/247/350/276/271/345/257/274/350/210/252.md +248 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/065-tabbar/346/240/207/347/255/276/346/240/217.md +314 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/066-badge/345/276/275/346/240/207.md +162 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/067-popover/346/260/224/346/263/241/345/274/271/345/207/272/346/241/206.md +325 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/068-cascader/347/272/247/350/201/224/351/200/211/346/213/251.md +360 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/069-selectperson/351/200/211/344/272/272/347/273/204/344/273/266.md +595 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/070-swipe/350/275/256/346/222/255.md +262 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/071-/345/233/275/351/231/205/345/214/226.md +51 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/072-easycalendar/346/227/245/345/216/206.md +132 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/073-qrcode/344/272/214/347/273/264/347/240/201.md +1538 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/074-imagescale/345/233/276/347/211/207/350/243/201/345/211/252.md +261 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/075-dragsort/346/213/226/346/213/275/346/216/222/345/272/217.md +161 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/076-chart/345/233/276/350/241/250.md +381 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/077-rtc/351/237/263/350/247/206/351/242/221.md +531 -0
- package/dist/data/m8mpdoc-develop/009-UI/347/273/204/344/273/266/078-table/350/241/250/346/240/274.md +849 -0
- package/dist/data/m8mpdoc-develop/012-Mock/347/232/204/344/275/277/347/224/250/Mock/347/232/204/344/275/277/347/224/250.md +116 -0
- package/dist/data/standards/css-style.md +531 -0
- package/dist/data/standards/js-style.md +394 -0
- package/dist/data/standards/project-structure.md +325 -0
- package/dist/data/standards/vue-style.md +644 -0
- package/dist/index.js +1 -0
- package/dist/tools/search.js +1 -0
- package/dist/tools/standards.js +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,644 @@
|
|
|
1
|
+
# Vue 组件编码规范
|
|
2
|
+
|
|
3
|
+
<!-- id: vue-style -->
|
|
4
|
+
<!-- category: vue -->
|
|
5
|
+
<!-- version: 1.2.0 -->
|
|
6
|
+
<!-- lastUpdated: 2024-12-22 -->
|
|
7
|
+
|
|
8
|
+
本规范定义了 M8 框架 Vue 组件的编码标准,适用于 M8.3 (Vue2) 和 M8.4 (Vue3) 项目。
|
|
9
|
+
|
|
10
|
+
## 文件头部注释
|
|
11
|
+
|
|
12
|
+
### .vue 文件必须包含头部注释
|
|
13
|
+
|
|
14
|
+
每个 .vue 文件必须在顶部添加标准化的注释块,包含作者、时间、版本、版权和描述信息。
|
|
15
|
+
|
|
16
|
+
```vue
|
|
17
|
+
<!--
|
|
18
|
+
* @作者: 张三
|
|
19
|
+
* @创建时间: 2024-11-11 14:20:03
|
|
20
|
+
* @修改时间: 2024-11-11 14:20:03
|
|
21
|
+
* @版本: [1.0]
|
|
22
|
+
* @版权: 国泰新点软件股份有限公司
|
|
23
|
+
* @描述: 用户信息展示组件
|
|
24
|
+
-->
|
|
25
|
+
<template>
|
|
26
|
+
<!-- 组件内容 -->
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script>
|
|
30
|
+
// ...
|
|
31
|
+
</script>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 注释字段说明
|
|
35
|
+
|
|
36
|
+
| 字段 | 说明 | 是否必填 |
|
|
37
|
+
| --------- | --------------------------------------- | -------- |
|
|
38
|
+
| @作者 | 文件创建者姓名 | 是 |
|
|
39
|
+
| @创建时间 | 文件创建时间,格式:YYYY-MM-DD HH:mm:ss | 是 |
|
|
40
|
+
| @修改时间 | 最后修改时间,格式:YYYY-MM-DD HH:mm:ss | 是 |
|
|
41
|
+
| @版本 | 组件版本号 | 是 |
|
|
42
|
+
| @版权 | 版权所有方 | 是 |
|
|
43
|
+
| @描述 | 组件功能描述 | 是 |
|
|
44
|
+
|
|
45
|
+
## 组件命名
|
|
46
|
+
|
|
47
|
+
### 组件文件命名使用 PascalCase
|
|
48
|
+
|
|
49
|
+
组件文件名应使用 PascalCase 命名法。
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
// ✅ 正确
|
|
53
|
+
UserProfile.vue;
|
|
54
|
+
TodoList.vue;
|
|
55
|
+
SearchInput.vue;
|
|
56
|
+
|
|
57
|
+
// ❌ 错误
|
|
58
|
+
userProfile.vue;
|
|
59
|
+
user - profile.vue;
|
|
60
|
+
todolist.vue;
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 基础组件使用特定前缀
|
|
64
|
+
|
|
65
|
+
应用特定样式和约定的基础组件应该全部以一个特定的前缀开头,比如 `Base`、`App` 或 `Ne`。
|
|
66
|
+
|
|
67
|
+
```javascript
|
|
68
|
+
// ✅ 正确
|
|
69
|
+
BaseButton.vue;
|
|
70
|
+
BaseTable.vue;
|
|
71
|
+
NeInput.vue;
|
|
72
|
+
|
|
73
|
+
// ❌ 错误
|
|
74
|
+
MyButton.vue;
|
|
75
|
+
VueTable.vue;
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Props 定义
|
|
79
|
+
|
|
80
|
+
### Props 必须指定类型
|
|
81
|
+
|
|
82
|
+
Props 定义应该尽量详细,至少需要指定其类型。
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
// ✅ 正确 - Vue2
|
|
86
|
+
export default {
|
|
87
|
+
props: {
|
|
88
|
+
status: {
|
|
89
|
+
type: String,
|
|
90
|
+
required: true,
|
|
91
|
+
validator: (value) => ['success', 'warning', 'error'].includes(value)
|
|
92
|
+
},
|
|
93
|
+
count: {
|
|
94
|
+
type: Number,
|
|
95
|
+
default: 0
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// ✅ 正确 - Vue3
|
|
101
|
+
const props = defineProps<{
|
|
102
|
+
status: 'success' | 'warning' | 'error';
|
|
103
|
+
count?: number;
|
|
104
|
+
}>();
|
|
105
|
+
|
|
106
|
+
// ❌ 错误
|
|
107
|
+
props: ['status', 'count']
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Props 命名使用 camelCase
|
|
111
|
+
|
|
112
|
+
在声明 props 时,其命名应该始终使用 camelCase。
|
|
113
|
+
|
|
114
|
+
```javascript
|
|
115
|
+
// ✅ 正确
|
|
116
|
+
props: {
|
|
117
|
+
greetingText: String
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// ❌ 错误
|
|
121
|
+
props: {
|
|
122
|
+
'greeting-text': String
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## 事件命名
|
|
127
|
+
|
|
128
|
+
### 事件名使用 kebab-case
|
|
129
|
+
|
|
130
|
+
事件名应该使用 kebab-case 命名。
|
|
131
|
+
|
|
132
|
+
```javascript
|
|
133
|
+
// ✅ 正确
|
|
134
|
+
this.$emit("item-click", item);
|
|
135
|
+
emit("update-value", newValue);
|
|
136
|
+
|
|
137
|
+
// ❌ 错误
|
|
138
|
+
this.$emit("itemClick", item);
|
|
139
|
+
emit("updateValue", newValue);
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## 模板规范
|
|
143
|
+
|
|
144
|
+
### 组件标签自闭合
|
|
145
|
+
|
|
146
|
+
没有内容的组件应该自闭合。
|
|
147
|
+
|
|
148
|
+
```html
|
|
149
|
+
<!-- ✅ 正确 -->
|
|
150
|
+
<MyComponent />
|
|
151
|
+
<ne-button type="primary" />
|
|
152
|
+
|
|
153
|
+
<!-- ❌ 错误 -->
|
|
154
|
+
<MyComponent></MyComponent>
|
|
155
|
+
<ne-button type="primary"></ne-button>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### 多属性换行
|
|
159
|
+
|
|
160
|
+
当组件有多个属性时,应该每个属性占一行。
|
|
161
|
+
|
|
162
|
+
```html
|
|
163
|
+
<!-- ✅ 正确 -->
|
|
164
|
+
<ne-field
|
|
165
|
+
v-model="formData.name"
|
|
166
|
+
label="姓名"
|
|
167
|
+
placeholder="请输入姓名"
|
|
168
|
+
required
|
|
169
|
+
:rules="nameRules"
|
|
170
|
+
/>
|
|
171
|
+
|
|
172
|
+
<!-- ❌ 错误 -->
|
|
173
|
+
<ne-field
|
|
174
|
+
v-model="formData.name"
|
|
175
|
+
label="姓名"
|
|
176
|
+
placeholder="请输入姓名"
|
|
177
|
+
required
|
|
178
|
+
:rules="nameRules"
|
|
179
|
+
/>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Vue3 Composition API 规范
|
|
183
|
+
|
|
184
|
+
### 使用 script setup
|
|
185
|
+
|
|
186
|
+
Vue3 项目推荐使用 `<script setup>` 语法。
|
|
187
|
+
|
|
188
|
+
```vue
|
|
189
|
+
<!-- ✅ 正确 -->
|
|
190
|
+
<script setup>
|
|
191
|
+
import { ref, computed } from "vue";
|
|
192
|
+
|
|
193
|
+
const count = ref(0);
|
|
194
|
+
const double = computed(() => count.value * 2);
|
|
195
|
+
</script>
|
|
196
|
+
|
|
197
|
+
<!-- ❌ 不推荐 -->
|
|
198
|
+
<script>
|
|
199
|
+
import { ref, computed, defineComponent } from "vue";
|
|
200
|
+
|
|
201
|
+
export default defineComponent({
|
|
202
|
+
setup() {
|
|
203
|
+
const count = ref(0);
|
|
204
|
+
return { count };
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
</script>
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### 响应式数据声明顺序
|
|
211
|
+
|
|
212
|
+
按照以下顺序组织代码:props/emits → refs → computed → watch → 生命周期 → methods
|
|
213
|
+
|
|
214
|
+
```vue
|
|
215
|
+
<script setup>
|
|
216
|
+
// 1. Props 和 Emits
|
|
217
|
+
const props = defineProps<{ title: string }>();
|
|
218
|
+
const emit = defineEmits<{ (e: 'update', value: string): void }>();
|
|
219
|
+
|
|
220
|
+
// 2. 响应式数据
|
|
221
|
+
const count = ref(0);
|
|
222
|
+
const list = ref([]);
|
|
223
|
+
|
|
224
|
+
// 3. 计算属性
|
|
225
|
+
const total = computed(() => list.value.length);
|
|
226
|
+
|
|
227
|
+
// 4. 侦听器
|
|
228
|
+
watch(count, (newVal) => {
|
|
229
|
+
console.log('count changed:', newVal);
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
// 5. 生命周期
|
|
233
|
+
onMounted(() => {
|
|
234
|
+
loadData();
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
// 6. 方法
|
|
238
|
+
function loadData() {
|
|
239
|
+
// ...
|
|
240
|
+
}
|
|
241
|
+
</script>
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## 样式规范
|
|
245
|
+
|
|
246
|
+
### 样式必须剥离到外部文件
|
|
247
|
+
|
|
248
|
+
Vue 组件的样式必须剥离到独立的 SCSS 文件中,通过 `@import` 方式引入,禁止在 `.vue` 文件中直接编写大量样式代码。
|
|
249
|
+
|
|
250
|
+
```vue
|
|
251
|
+
<!-- ✅ 正确 - 样式剥离到外部文件 -->
|
|
252
|
+
<template>
|
|
253
|
+
<div class="login_page">
|
|
254
|
+
<!-- 组件内容 -->
|
|
255
|
+
</div>
|
|
256
|
+
</template>
|
|
257
|
+
|
|
258
|
+
<script setup>
|
|
259
|
+
// ...
|
|
260
|
+
</script>
|
|
261
|
+
|
|
262
|
+
<style lang="scss" scoped>
|
|
263
|
+
@import "./css/login.scss";
|
|
264
|
+
</style>
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
```scss
|
|
268
|
+
// ./css/login.scss
|
|
269
|
+
.login_page {
|
|
270
|
+
display: flex;
|
|
271
|
+
align-items: center;
|
|
272
|
+
justify-content: center;
|
|
273
|
+
min-height: 100vh;
|
|
274
|
+
background: $color-bg-gray;
|
|
275
|
+
|
|
276
|
+
.login_form {
|
|
277
|
+
width: 400px;
|
|
278
|
+
padding: $spacing-lg;
|
|
279
|
+
background: $color-bg-base;
|
|
280
|
+
border-radius: 8px;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.login_title {
|
|
284
|
+
font-size: $font-size-xl;
|
|
285
|
+
color: $color-text-primary;
|
|
286
|
+
text-align: center;
|
|
287
|
+
margin-bottom: $spacing-lg;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
```vue
|
|
293
|
+
<!-- ❌ 错误 - 样式直接写在 .vue 文件中 -->
|
|
294
|
+
<template>
|
|
295
|
+
<div class="login_page">
|
|
296
|
+
<!-- 组件内容 -->
|
|
297
|
+
</div>
|
|
298
|
+
</template>
|
|
299
|
+
|
|
300
|
+
<style lang="scss" scoped>
|
|
301
|
+
.login_page {
|
|
302
|
+
display: flex;
|
|
303
|
+
align-items: center;
|
|
304
|
+
justify-content: center;
|
|
305
|
+
min-height: 100vh;
|
|
306
|
+
background: #f5f5f5;
|
|
307
|
+
|
|
308
|
+
.login_form {
|
|
309
|
+
width: 400px;
|
|
310
|
+
padding: 24px;
|
|
311
|
+
background: #fff;
|
|
312
|
+
border-radius: 8px;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/* 大量样式代码... */
|
|
316
|
+
}
|
|
317
|
+
</style>
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### style 标签必须使用 scoped
|
|
321
|
+
|
|
322
|
+
为避免样式污染,`<style>` 标签必须添加 `scoped` 属性。
|
|
323
|
+
|
|
324
|
+
```vue
|
|
325
|
+
<!-- ✅ 正确 -->
|
|
326
|
+
<style lang="scss" scoped>
|
|
327
|
+
@import "./css/user-profile.scss";
|
|
328
|
+
</style>
|
|
329
|
+
|
|
330
|
+
<!-- ❌ 错误 - 缺少 scoped -->
|
|
331
|
+
<style lang="scss">
|
|
332
|
+
@import "./css/user-profile.scss";
|
|
333
|
+
</style>
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### 样式文件目录结构
|
|
337
|
+
|
|
338
|
+
组件样式文件应放在组件同级的 `css` 目录下,文件名与组件名保持一致(使用 kebab-case)。
|
|
339
|
+
|
|
340
|
+
```
|
|
341
|
+
src/
|
|
342
|
+
├── views/
|
|
343
|
+
│ ├── login/
|
|
344
|
+
│ │ ├── Login.vue
|
|
345
|
+
│ │ └── css/
|
|
346
|
+
│ │ └── login.scss
|
|
347
|
+
│ ├── user/
|
|
348
|
+
│ │ ├── UserProfile.vue
|
|
349
|
+
│ │ ├── UserList.vue
|
|
350
|
+
│ │ └── css/
|
|
351
|
+
│ │ ├── user-profile.scss
|
|
352
|
+
│ │ └── user-list.scss
|
|
353
|
+
├── components/
|
|
354
|
+
│ ├── common/
|
|
355
|
+
│ │ ├── BaseButton.vue
|
|
356
|
+
│ │ ├── BaseInput.vue
|
|
357
|
+
│ │ └── css/
|
|
358
|
+
│ │ ├── base-button.scss
|
|
359
|
+
│ │ └── base-input.scss
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### 简单组件样式例外
|
|
363
|
+
|
|
364
|
+
对于样式代码少于 20 行的简单组件,可以直接在 `.vue` 文件中编写样式,但仍需使用 `scoped`。
|
|
365
|
+
|
|
366
|
+
```vue
|
|
367
|
+
<!-- ✅ 允许 - 简单组件样式少于 20 行 -->
|
|
368
|
+
<template>
|
|
369
|
+
<span class="tag" :class="type">{{ text }}</span>
|
|
370
|
+
</template>
|
|
371
|
+
|
|
372
|
+
<script setup>
|
|
373
|
+
defineProps<{
|
|
374
|
+
text: string;
|
|
375
|
+
type?: 'primary' | 'success' | 'warning';
|
|
376
|
+
}>();
|
|
377
|
+
</script>
|
|
378
|
+
|
|
379
|
+
<style lang="scss" scoped>
|
|
380
|
+
.tag {
|
|
381
|
+
display: inline-block;
|
|
382
|
+
padding: 2px 8px;
|
|
383
|
+
font-size: 12px;
|
|
384
|
+
border-radius: 4px;
|
|
385
|
+
|
|
386
|
+
&.primary {
|
|
387
|
+
background: #e6f7ff;
|
|
388
|
+
color: #1890ff;
|
|
389
|
+
}
|
|
390
|
+
&.success {
|
|
391
|
+
background: #f6ffed;
|
|
392
|
+
color: #52c41a;
|
|
393
|
+
}
|
|
394
|
+
&.warning {
|
|
395
|
+
background: #fffbe6;
|
|
396
|
+
color: #faad14;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
</style>
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
### 全局样式与组件样式分离
|
|
403
|
+
|
|
404
|
+
全局样式(如 reset、变量、mixins)应放在 `src/styles/` 目录下统一管理。
|
|
405
|
+
|
|
406
|
+
```
|
|
407
|
+
src/
|
|
408
|
+
├── styles/
|
|
409
|
+
│ ├── index.scss # 入口文件
|
|
410
|
+
│ ├── variables.scss # SASS 变量
|
|
411
|
+
│ ├── mixins.scss # SASS mixins
|
|
412
|
+
│ ├── reset.scss # 样式重置
|
|
413
|
+
│ └── common.scss # 公共样式
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
```scss
|
|
417
|
+
// src/styles/index.scss
|
|
418
|
+
@import "./variables.scss";
|
|
419
|
+
@import "./mixins.scss";
|
|
420
|
+
@import "./reset.scss";
|
|
421
|
+
@import "./common.scss";
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
## 页面重构规范
|
|
425
|
+
|
|
426
|
+
### 重构页面时不添加导航栏
|
|
427
|
+
|
|
428
|
+
重构现有页面时,不需要添加 `em-header` 或 `nav-bar` 导航栏组件。导航栏由框架或原生容器统一管理,页面组件只需关注内容区域。
|
|
429
|
+
|
|
430
|
+
```vue
|
|
431
|
+
<!-- ✅ 正确 - 重构页面不添加导航栏 -->
|
|
432
|
+
<template>
|
|
433
|
+
<div class="page-container">
|
|
434
|
+
<!-- 页面主体内容 -->
|
|
435
|
+
<div class="content">
|
|
436
|
+
<em-cell title="用户信息" />
|
|
437
|
+
<em-cell title="设置" />
|
|
438
|
+
</div>
|
|
439
|
+
</div>
|
|
440
|
+
</template>
|
|
441
|
+
|
|
442
|
+
<script setup>
|
|
443
|
+
// 页面逻辑
|
|
444
|
+
</script>
|
|
445
|
+
|
|
446
|
+
<style lang="scss" scoped>
|
|
447
|
+
@import "./css/page.scss";
|
|
448
|
+
</style>
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
```vue
|
|
452
|
+
<!-- ❌ 错误 - 重构页面添加了导航栏 -->
|
|
453
|
+
<template>
|
|
454
|
+
<div class="page-container">
|
|
455
|
+
<!-- 不应该在重构页面中添加导航栏 -->
|
|
456
|
+
<em-header title="页面标题" />
|
|
457
|
+
|
|
458
|
+
<div class="content">
|
|
459
|
+
<em-cell title="用户信息" />
|
|
460
|
+
<em-cell title="设置" />
|
|
461
|
+
</div>
|
|
462
|
+
</div>
|
|
463
|
+
</template>
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
### 导航栏使用场景说明
|
|
467
|
+
|
|
468
|
+
| 场景 | 是否添加导航栏 | 说明 |
|
|
469
|
+
| ------------- | -------------- | ------------------------ |
|
|
470
|
+
| 重构现有页面 | ❌ 否 | 导航栏由框架统一管理 |
|
|
471
|
+
| 新建独立页面 | ✅ 是 | 需要自定义导航栏时可添加 |
|
|
472
|
+
| 嵌入式组件 | ❌ 否 | 组件不应包含导航栏 |
|
|
473
|
+
| 弹窗/抽屉内容 | ❌ 否 | 弹窗有自己的头部处理 |
|
|
474
|
+
|
|
475
|
+
### 页面重构最佳实践
|
|
476
|
+
|
|
477
|
+
1. **保持页面结构简洁**:页面组件只包含内容区域,不包含导航栏
|
|
478
|
+
2. **使用框架提供的页面配置**:通过 `pages.json` 或路由配置设置页面标题
|
|
479
|
+
3. **避免重复的导航逻辑**:导航返回等功能由框架统一处理
|
|
480
|
+
|
|
481
|
+
```javascript
|
|
482
|
+
// pages.json 配置页面标题(推荐方式)
|
|
483
|
+
{
|
|
484
|
+
"pages": [
|
|
485
|
+
{
|
|
486
|
+
"path": "pages/user/index",
|
|
487
|
+
"style": {
|
|
488
|
+
"navigationBarTitleText": "用户中心"
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
]
|
|
492
|
+
}
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
## 反模式
|
|
496
|
+
|
|
497
|
+
### 避免在模板中使用复杂表达式
|
|
498
|
+
|
|
499
|
+
```javascript
|
|
500
|
+
// ❌ 错误 - 模板中的复杂表达式
|
|
501
|
+
<template>
|
|
502
|
+
<div>{{ items.filter(i => i.active).map(i => i.name).join(', ') }}</div>
|
|
503
|
+
</template>
|
|
504
|
+
|
|
505
|
+
// ✅ 正确 - 使用计算属性
|
|
506
|
+
<template>
|
|
507
|
+
<div>{{ activeItemNames }}</div>
|
|
508
|
+
</template>
|
|
509
|
+
|
|
510
|
+
<script setup>
|
|
511
|
+
const activeItemNames = computed(() =>
|
|
512
|
+
items.value.filter(i => i.active).map(i => i.name).join(', ')
|
|
513
|
+
);
|
|
514
|
+
</script>
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
### 避免直接修改 Props
|
|
518
|
+
|
|
519
|
+
```javascript
|
|
520
|
+
// ❌ 错误
|
|
521
|
+
props.value = newValue;
|
|
522
|
+
|
|
523
|
+
// ✅ 正确 - 使用 emit 通知父组件
|
|
524
|
+
emit("update:value", newValue);
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
## M8 框架开发规范
|
|
528
|
+
|
|
529
|
+
### 版本兼容性与检测
|
|
530
|
+
|
|
531
|
+
在开始项目前,必须确定 Vue 版本:
|
|
532
|
+
|
|
533
|
+
- **Vue2**: `"vue": "^2.x.x"`
|
|
534
|
+
- **Vue3**: `"vue": "^3.x.x"`
|
|
535
|
+
|
|
536
|
+
**在输出最终代码前,必须验证所有语法与检测到的 Vue 版本完全兼容。**
|
|
537
|
+
|
|
538
|
+
### UI 组件使用规范
|
|
539
|
+
|
|
540
|
+
优先使用 `ejs.ui.*` 原生 API,其次使用 M8 UI 组件库。
|
|
541
|
+
|
|
542
|
+
**常用组件列表 (优先检索 epoint-mrc-mcp)**:
|
|
543
|
+
|
|
544
|
+
- 按钮: `em-button`
|
|
545
|
+
- 单元格: `em-cell`
|
|
546
|
+
- 输入框: `em-field` (注意:数字类型应控制仅输入数字)
|
|
547
|
+
- 搜索: `em-search`
|
|
548
|
+
- 上传: `em-uploader`
|
|
549
|
+
- 下拉刷新: `em-minirefresh`
|
|
550
|
+
- 列表项: `em-cell`
|
|
551
|
+
|
|
552
|
+
**API vs 组件**:
|
|
553
|
+
|
|
554
|
+
1. **选择器**: 单选/多选优先用 `ejs.ui.picker`;日期/时间优先用 `ejs.ui.pickDate/Time`。
|
|
555
|
+
2. **弹窗**: 确认/提示优先用 `ejs.ui.confirm/alert`。
|
|
556
|
+
3. **交互**: Toast 使用 `ejs.ui.toast` (非组件);Loading 使用 `ejs.ui.showWaiting`。
|
|
557
|
+
|
|
558
|
+
### 输入框交互规范
|
|
559
|
+
|
|
560
|
+
当输入框 (`em-field`) 为 `readonly` 但需要点击触发操作(如弹出选择器)时,必须同时添加 `is-link` 和 `clickable` 属性。
|
|
561
|
+
|
|
562
|
+
```html
|
|
563
|
+
<!-- ✅ 正确示例 -->
|
|
564
|
+
<em-field
|
|
565
|
+
v-model="date"
|
|
566
|
+
readonly
|
|
567
|
+
clickable
|
|
568
|
+
is-link
|
|
569
|
+
label="选择日期"
|
|
570
|
+
@click="showDatePicker"
|
|
571
|
+
/>
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
### 状态管理规范
|
|
575
|
+
|
|
576
|
+
#### Vue2 (Vuex)
|
|
577
|
+
|
|
578
|
+
**文件**: `src/pages/[module]/store.js`
|
|
579
|
+
|
|
580
|
+
```javascript
|
|
581
|
+
export default {
|
|
582
|
+
namespaced: true,
|
|
583
|
+
state: { count: 0 },
|
|
584
|
+
mutations: {
|
|
585
|
+
increment(state, n) {
|
|
586
|
+
state.count += n;
|
|
587
|
+
},
|
|
588
|
+
},
|
|
589
|
+
};
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
**使用**: `this.$store.state.[module].count`, `this.$store.commit('[module]/increment', 1)`
|
|
593
|
+
|
|
594
|
+
#### Vue3 (Pinia)
|
|
595
|
+
|
|
596
|
+
**文件**: `src/pages/[module]/store.ts`
|
|
597
|
+
|
|
598
|
+
```typescript
|
|
599
|
+
import { defineStore } from "pinia";
|
|
600
|
+
export const useIndexStore = defineStore("index", {
|
|
601
|
+
state: () => ({ count: 0 }),
|
|
602
|
+
actions: {
|
|
603
|
+
increment() {
|
|
604
|
+
this.count++;
|
|
605
|
+
},
|
|
606
|
+
},
|
|
607
|
+
});
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
### 路由配置 (router.js)
|
|
611
|
+
|
|
612
|
+
每个模块目录下必须包含 `router.js`,定义该模块的路由和导航栏样式。
|
|
613
|
+
|
|
614
|
+
```javascript
|
|
615
|
+
// src/pages/[module]/router.js
|
|
616
|
+
const routes = [
|
|
617
|
+
{
|
|
618
|
+
path: "pages/demo/index", // 必须与 vue 文件路径匹配
|
|
619
|
+
style: {
|
|
620
|
+
navigationBarTitleText: "演示页面",
|
|
621
|
+
navigationStyle: "custom", // 推荐使用 custom
|
|
622
|
+
},
|
|
623
|
+
},
|
|
624
|
+
];
|
|
625
|
+
const options = { autoSubPackages: true, isFirstModule: false };
|
|
626
|
+
export default { routes, options };
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
### Mock 数据规范
|
|
630
|
+
|
|
631
|
+
当提示使用 Mock 时,请在模块下创建 `mock.js`。
|
|
632
|
+
|
|
633
|
+
```javascript
|
|
634
|
+
import Mock from "@mock";
|
|
635
|
+
export default [
|
|
636
|
+
{
|
|
637
|
+
methodUrl: "/rest/mock/list",
|
|
638
|
+
input: {},
|
|
639
|
+
output: Mock.mock({
|
|
640
|
+
"list|10": [{ "id|+1": 1, title: "@ctitle" }],
|
|
641
|
+
}),
|
|
642
|
+
},
|
|
643
|
+
];
|
|
644
|
+
```
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';const a1_0x1db6f2=a1_0x52ba;function a1_0x52ba(_0x2cf91b,_0x43a847){_0x2cf91b=_0x2cf91b-0xae;const _0x2c1904=a1_0x5dd2();let _0x413be7=_0x2c1904[_0x2cf91b];return _0x413be7;}(function(_0x1f2849,_0x11fbf5){const _0x451f66=a1_0x52ba,_0x440614=_0x1f2849();while(!![]){try{const _0x44a865=-parseInt(_0x451f66(0xc2))/0x1+parseInt(_0x451f66(0xeb))/0x2+parseInt(_0x451f66(0xb0))/0x3+-parseInt(_0x451f66(0xc3))/0x4*(parseInt(_0x451f66(0xae))/0x5)+parseInt(_0x451f66(0xd4))/0x6*(parseInt(_0x451f66(0xba))/0x7)+-parseInt(_0x451f66(0xb5))/0x8*(parseInt(_0x451f66(0xb2))/0x9)+parseInt(_0x451f66(0xd5))/0xa;if(_0x44a865===_0x11fbf5)break;else _0x440614['push'](_0x440614['shift']());}catch(_0x5d854a){_0x440614['push'](_0x440614['shift']());}}}(a1_0x5dd2,0xdd389));function a1_0x5dd2(){const _0x375237=['927VXTNXC','map','(((.+)+)+)+$','140704DBHJgk','Unknown\x20tool:\x20','setRequestHandler','No\x20matches\x20found\x20in\x20EJS\x20API\x20documentation.','The\x20type\x20of\x20standard\x20to\x20retrieve','110243jXQwDh','object','searchEjsDocs','search_m8_docs','StdioServerTransport','catch','connect','@modelcontextprotocol/sdk/types.js','771899xrnClf','24vexVeX','1.0.0','Error\x20executing\x20tool\x20','length','vue','apply','\x0a---','filePath','getFileContent','project','get_coding_standards','search','text','Get\x20the\x20built-in\x20coding\x20standards\x20for\x20M8/EJS\x20projects.','exit','ListToolsRequestSchema','query','270lpLhTi','3415640LaUELe','\x20matches:\x0a\x0a','./tools/search.js','searchM8Docs','toString','The\x20absolute\x20path\x20of\x20the\x20file\x20to\x20read\x20(returned\x20by\x20search\x20tools)','No\x20matches\x20found\x20in\x20M8\x20documentation.','\x0aPath:\x20','__esModule','Read\x20the\x20full\x20content\x20of\x20a\x20documentation\x20file.\x20Use\x20this\x20after\x20searching\x20to\x20get\x20the\x20usage\x20details.','The\x20search\x20query\x20(e.g.,\x20\x27uploader\x27,\x20\x27ajax\x27,\x20\x27encryption\x27)','Search\x20EJS\x20native\x20API\x20documentation\x20directly.\x20Use\x20this\x20for\x20native\x20capabilities\x20like\x20audio,\x20camera,\x20storage.','join','file','./tools/standards.js','preview','read_doc_file','message','@modelcontextprotocol/sdk/server/stdio.js','string','Found\x20','all','3124988SUPemY','error','773030ZztmqL','File\x20not\x20found\x20or\x20empty.','5413371vZkIes','path'];a1_0x5dd2=function(){return _0x375237;};return a1_0x5dd2();}Object['defineProperty'](exports,a1_0x1db6f2(0xdd),{'value':!![]});const index_js_1=require('@modelcontextprotocol/sdk/server/index.js'),stdio_js_1=require(a1_0x1db6f2(0xe7)),types_js_1=require(a1_0x1db6f2(0xc1)),search_js_1=require(a1_0x1db6f2(0xd7)),standards_js_1=require(a1_0x1db6f2(0xe3)),server=new index_js_1['Server']({'name':'m8-mcp-server','version':a1_0x1db6f2(0xc4)},{'capabilities':{'tools':{}}}),TOOLS=[{'name':a1_0x1db6f2(0xbd),'description':'Search\x20M8\x20Framework\x20documentation\x20directly.\x20Use\x20this\x20to\x20find\x20UI\x20components,\x20utility\x20functions,\x20or\x20examples.','inputSchema':{'type':'object','properties':{'query':{'type':'string','description':a1_0x1db6f2(0xdf)}},'required':[a1_0x1db6f2(0xd3)]}},{'name':'search_ejs_api','description':a1_0x1db6f2(0xe0),'inputSchema':{'type':a1_0x1db6f2(0xbb),'properties':{'query':{'type':a1_0x1db6f2(0xe8),'description':'The\x20search\x20query\x20(e.g.,\x20\x27audio\x27,\x20\x27file\x27)'}},'required':['query']}},{'name':a1_0x1db6f2(0xe5),'description':a1_0x1db6f2(0xde),'inputSchema':{'type':a1_0x1db6f2(0xbb),'properties':{'filePath':{'type':a1_0x1db6f2(0xe8),'description':a1_0x1db6f2(0xda)}},'required':[a1_0x1db6f2(0xca)]}},{'name':a1_0x1db6f2(0xcd),'description':a1_0x1db6f2(0xd0),'inputSchema':{'type':a1_0x1db6f2(0xbb),'properties':{'type':{'type':a1_0x1db6f2(0xe8),'enum':['js',a1_0x1db6f2(0xc7),'css',a1_0x1db6f2(0xcc),a1_0x1db6f2(0xea)],'description':a1_0x1db6f2(0xb9)}},'required':['type']}}];server[a1_0x1db6f2(0xb7)](types_js_1[a1_0x1db6f2(0xd2)],async()=>{return{'tools':TOOLS};}),server['setRequestHandler'](types_js_1['CallToolRequestSchema'],async _0x2905dc=>{const _0x15c9f0=a1_0x1db6f2,{name:_0x1d8a80,arguments:_0x1ded68}=_0x2905dc['params'];try{if(_0x1d8a80===_0x15c9f0(0xbd)){const _0x3a832e=_0x1ded68['query'],_0x18fddd=await(0x0,search_js_1[_0x15c9f0(0xd8)])(_0x3a832e);if(_0x18fddd[_0x15c9f0(0xc6)]===0x0)return{'content':[{'type':_0x15c9f0(0xcf),'text':_0x15c9f0(0xdb)}]};const _0x36afa5=_0x18fddd['map'](_0x2580e0=>'File:\x20'+_0x2580e0[_0x15c9f0(0xe2)]+_0x15c9f0(0xdc)+_0x2580e0[_0x15c9f0(0xb1)]+'\x0aSnippet:\x20'+_0x2580e0[_0x15c9f0(0xe4)]+'\x0a---')[_0x15c9f0(0xe1)]('\x0a');return{'content':[{'type':'text','text':_0x15c9f0(0xe9)+_0x18fddd[_0x15c9f0(0xc6)]+'\x20matches:\x0a\x0a'+_0x36afa5}]};}if(_0x1d8a80==='search_ejs_api'){const _0x664529=_0x1ded68[_0x15c9f0(0xd3)],_0x5c07af=await(0x0,search_js_1[_0x15c9f0(0xbc)])(_0x664529);if(_0x5c07af[_0x15c9f0(0xc6)]===0x0)return{'content':[{'type':_0x15c9f0(0xcf),'text':_0x15c9f0(0xb8)}]};const _0x566fdd=_0x5c07af[_0x15c9f0(0xb3)](_0x1102de=>'File:\x20'+_0x1102de[_0x15c9f0(0xe2)]+_0x15c9f0(0xdc)+_0x1102de[_0x15c9f0(0xb1)]+'\x0aSnippet:\x20'+_0x1102de[_0x15c9f0(0xe4)]+_0x15c9f0(0xc9))[_0x15c9f0(0xe1)]('\x0a');return{'content':[{'type':_0x15c9f0(0xcf),'text':'Found\x20'+_0x5c07af[_0x15c9f0(0xc6)]+_0x15c9f0(0xd6)+_0x566fdd}]};}if(_0x1d8a80===_0x15c9f0(0xe5)){const _0x3ba6bf=_0x1ded68[_0x15c9f0(0xca)],_0x17f84a=(0x0,search_js_1[_0x15c9f0(0xcb)])(_0x3ba6bf);return{'content':[{'type':_0x15c9f0(0xcf),'text':_0x17f84a||_0x15c9f0(0xaf)}]};}if(_0x1d8a80==='get_coding_standards'){const _0x48125b=_0x1ded68['type'],_0x1f8b8d=(0x0,standards_js_1['getStandards'])(_0x48125b);return{'content':[{'type':_0x15c9f0(0xcf),'text':_0x1f8b8d}]};}throw new Error(_0x15c9f0(0xb6)+_0x1d8a80);}catch(_0xa0766){return{'content':[{'type':_0x15c9f0(0xcf),'text':_0x15c9f0(0xc5)+_0x1d8a80+':\x20'+_0xa0766[_0x15c9f0(0xe6)]}],'isError':!![]};}});async function runServer(){const _0x24c8e3=a1_0x1db6f2,_0x555cb8=(function(){let _0x23939c=!![];return function(_0x1ea4a0,_0x546989){const _0x3090a6=_0x23939c?function(){const _0x32e359=a1_0x52ba;if(_0x546989){const _0x4a3dbc=_0x546989[_0x32e359(0xc8)](_0x1ea4a0,arguments);return _0x546989=null,_0x4a3dbc;}}:function(){};return _0x23939c=![],_0x3090a6;};}()),_0x468565=_0x555cb8(this,function(){const _0x5c3525=a1_0x52ba;return _0x468565['toString']()[_0x5c3525(0xce)](_0x5c3525(0xb4))[_0x5c3525(0xd9)]()['constructor'](_0x468565)[_0x5c3525(0xce)]('(((.+)+)+)+$');});_0x468565();const _0x1b26e4=new stdio_js_1[(_0x24c8e3(0xbe))]();await server[_0x24c8e3(0xc0)](_0x1b26e4),console[_0x24c8e3(0xec)]('M8\x20MCP\x20Server\x20running\x20on\x20stdio');}runServer()[a1_0x1db6f2(0xbf)](_0x59a8f4=>{const _0x1a8e10=a1_0x1db6f2;console['error']('Fatal\x20error\x20running\x20server:',_0x59a8f4),process[_0x1a8e10(0xd1)](0x1);});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a2_0x2be492=a2_0x1d31;(function(_0x3beeec,_0x44dd9e){const _0xad8b76=a2_0x1d31,_0xd82cee=_0x3beeec();while(!![]){try{const _0x292ae7=-parseInt(_0xad8b76(0x138))/0x1*(parseInt(_0xad8b76(0x127))/0x2)+-parseInt(_0xad8b76(0x133))/0x3*(-parseInt(_0xad8b76(0x12c))/0x4)+-parseInt(_0xad8b76(0x134))/0x5+-parseInt(_0xad8b76(0x11f))/0x6+parseInt(_0xad8b76(0x131))/0x7*(parseInt(_0xad8b76(0x130))/0x8)+-parseInt(_0xad8b76(0x143))/0x9+parseInt(_0xad8b76(0x124))/0xa*(parseInt(_0xad8b76(0x126))/0xb);if(_0x292ae7===_0x44dd9e)break;else _0xd82cee['push'](_0xd82cee['shift']());}catch(_0x29d974){_0xd82cee['push'](_0xd82cee['shift']());}}}(a2_0x282a,0x9477c));const a2_0x54b708=(function(){let _0x1ea21c=!![];return function(_0x5c594b,_0x273fe6){const _0xea4123=_0x1ea21c?function(){if(_0x273fe6){const _0x4d02e1=_0x273fe6['apply'](_0x5c594b,arguments);return _0x273fe6=null,_0x4d02e1;}}:function(){};return _0x1ea21c=![],_0xea4123;};}()),a2_0xb83719=a2_0x54b708(this,function(){const _0x261efd=a2_0x1d31;return a2_0xb83719[_0x261efd(0x149)]()[_0x261efd(0x121)]('(((.+)+)+)+$')[_0x261efd(0x149)]()[_0x261efd(0x125)](a2_0xb83719)[_0x261efd(0x121)]('(((.+)+)+)+$');});a2_0xb83719();'use strict';var __importDefault=this&&this[a2_0x2be492(0x140)]||function(_0x1b4a92){const _0x46dcf3=a2_0x2be492;return _0x1b4a92&&_0x1b4a92[_0x46dcf3(0x132)]?_0x1b4a92:{'default':_0x1b4a92};};Object[a2_0x2be492(0x13f)](exports,a2_0x2be492(0x132),{'value':!![]}),exports[a2_0x2be492(0x13c)]=searchM8Docs,exports['searchEjsDocs']=searchEjsDocs,exports[a2_0x2be492(0x146)]=getFileContent;const fs_1=__importDefault(require('fs')),path_1=__importDefault(require(a2_0x2be492(0x129))),fast_glob_1=__importDefault(require(a2_0x2be492(0x128))),constants_js_1=require(a2_0x2be492(0x145));async function searchM8Docs(_0x9bddb2){const _0x33f421=a2_0x2be492,_0x592f5d=path_1['default'][_0x33f421(0x13b)]((0x0,constants_js_1[_0x33f421(0x142)])(),constants_js_1[_0x33f421(0x147)]);return await searchInDirectory(_0x592f5d,_0x9bddb2);}async function searchEjsDocs(_0x373fbc){const _0x58526c=a2_0x2be492,_0xa65d58=path_1[_0x58526c(0x12d)]['join']((0x0,constants_js_1[_0x58526c(0x142)])(),constants_js_1[_0x58526c(0x13d)]);return await searchInDirectory(_0xa65d58,_0x373fbc);}async function searchInDirectory(_0x354429,_0x541a04){const _0x3813b9=a2_0x2be492;if(!fs_1[_0x3813b9(0x12d)]['existsSync'](_0x354429))return console[_0x3813b9(0x139)](_0x3813b9(0x136)+_0x354429),[];const _0x922f05=await(0x0,fast_glob_1[_0x3813b9(0x12d)])(_0x3813b9(0x135),{'cwd':_0x354429,'absolute':!![]}),_0x584f3b=[],_0x9ba5de=_0x541a04['toLowerCase']();for(const _0x39ad82 of _0x922f05){const _0x3fef4d=fs_1[_0x3813b9(0x12d)]['readFileSync'](_0x39ad82,'utf-8'),_0xd3b560=path_1[_0x3813b9(0x12d)][_0x3813b9(0x12a)](_0x39ad82);let _0x2c0f05=0x0;if(_0xd3b560['toLowerCase']()['includes'](_0x9ba5de))_0x2c0f05+=0xa;if(_0x3fef4d[_0x3813b9(0x141)]()[_0x3813b9(0x122)](_0x9ba5de))_0x2c0f05+=0x1;if(_0x2c0f05>0x0){const _0x39161e=_0x3fef4d[_0x3813b9(0x141)]()[_0x3813b9(0x12b)](_0x9ba5de);let _0x1d4429='';if(_0x39161e>=0x0){const _0x393227=Math['max'](0x0,_0x39161e-0x32),_0x2eeceb=Math[_0x3813b9(0x13a)](_0x3fef4d[_0x3813b9(0x13e)],_0x39161e+0x64);_0x1d4429=_0x3813b9(0x120)+_0x3fef4d[_0x3813b9(0x148)](_0x393227,_0x2eeceb)[_0x3813b9(0x123)](/\n/g,'\x20')+_0x3813b9(0x120);}else _0x1d4429=_0x3fef4d['substring'](0x0,0x64)['replace'](/\n/g,'\x20')+_0x3813b9(0x120);_0x584f3b['push']({'file':_0xd3b560,'path':_0x39ad82,'preview':_0x1d4429,'score':_0x2c0f05});}}return _0x584f3b['sort']((_0x53dca1,_0x3f0840)=>(_0x3f0840[_0x3813b9(0x12e)]||0x0)-(_0x53dca1[_0x3813b9(0x12e)]||0x0))['slice'](0x0,0x5);}function a2_0x1d31(_0x3f79eb,_0x4f3d14){_0x3f79eb=_0x3f79eb-0x11f;const _0x1c473a=a2_0x282a();let _0xb83719=_0x1c473a[_0x3f79eb];return _0xb83719;}function getFileContent(_0x47675d){const _0x1f3871=a2_0x2be492;if(fs_1[_0x1f3871(0x12d)][_0x1f3871(0x12f)](_0x47675d))return fs_1[_0x1f3871(0x12d)][_0x1f3871(0x144)](_0x47675d,_0x1f3871(0x137));return'';}function a2_0x282a(){const _0x333998=['score','existsSync','408RnbOkH','55244PEXLpS','__esModule','78YlnOoR','5683885VNvxgD','**/*.md','Directory\x20not\x20found:\x20','utf-8','27PcbcFh','error','min','join','searchM8Docs','EJS_DOCS_DIR','length','defineProperty','__importDefault','toLowerCase','getDataDir','3709962bYhVSA','readFileSync','../constants.js','getFileContent','M8_DOCS_DIR','substring','toString','519498jgediA','...','search','includes','replace','10jaZYRN','constructor','8999815dYTibg','13370Ipcfji','fast-glob','path','basename','indexOf','185160WcfPzK','default'];a2_0x282a=function(){return _0x333998;};return a2_0x282a();}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a3_0x385026=a3_0x43cf;(function(_0x52a665,_0x74fecb){const _0x227318=a3_0x43cf,_0x464f9c=_0x52a665();while(!![]){try{const _0x2ac706=-parseInt(_0x227318(0x102))/0x1+parseInt(_0x227318(0xf2))/0x2+-parseInt(_0x227318(0xfe))/0x3*(-parseInt(_0x227318(0xf1))/0x4)+-parseInt(_0x227318(0x105))/0x5+-parseInt(_0x227318(0xf0))/0x6+parseInt(_0x227318(0xec))/0x7+-parseInt(_0x227318(0x106))/0x8*(-parseInt(_0x227318(0xfb))/0x9);if(_0x2ac706===_0x74fecb)break;else _0x464f9c['push'](_0x464f9c['shift']());}catch(_0x44a6f9){_0x464f9c['push'](_0x464f9c['shift']());}}}(a3_0x586a,0xc2f26));const a3_0x691720=(function(){let _0x48f58a=!![];return function(_0x1e18bf,_0x6fc0f){const _0x46acdd=_0x48f58a?function(){if(_0x6fc0f){const _0xc49be6=_0x6fc0f['apply'](_0x1e18bf,arguments);return _0x6fc0f=null,_0xc49be6;}}:function(){};return _0x48f58a=![],_0x46acdd;};}()),a3_0x3fe268=a3_0x691720(this,function(){const _0x2a1dc8=a3_0x43cf;return a3_0x3fe268[_0x2a1dc8(0xf6)]()[_0x2a1dc8(0xf5)](_0x2a1dc8(0x104))[_0x2a1dc8(0xf6)]()[_0x2a1dc8(0xf9)](a3_0x3fe268)['search'](_0x2a1dc8(0x104));});a3_0x3fe268();'use strict';var __importDefault=this&&this[a3_0x385026(0xf4)]||function(_0x3e2481){return _0x3e2481&&_0x3e2481['__esModule']?_0x3e2481:{'default':_0x3e2481};};Object['defineProperty'](exports,a3_0x385026(0x101),{'value':!![]}),exports['getStandards']=getStandards;function a3_0x586a(){const _0x72cda8=['search','toString','keys','existsSync','constructor','default','18zqymlr','path','project-structure.md','151341uIwhsa','STANDARDS_DIR','toUpperCase','__esModule','1356145cQWbjl','getDataDir','(((.+)+)+)+$','6584250kpsCPB','6684776fXgJRs','\x0a\x0a#\x20','../constants.js','10590328THLfca','css-style.md','\x20Standards\x0a\x0a','join','4345314OLUmiq','36znkApN','1115190UcKogn','js-style.md','__importDefault'];a3_0x586a=function(){return _0x72cda8;};return a3_0x586a();}const fs_1=__importDefault(require('fs')),path_1=__importDefault(require(a3_0x385026(0xfc))),constants_js_1=require(a3_0x385026(0xeb));function getStandards(_0x5c4513){const _0x36a8d9=a3_0x385026,_0xfabe4b=path_1['default'][_0x36a8d9(0xef)]((0x0,constants_js_1[_0x36a8d9(0x103)])(),constants_js_1[_0x36a8d9(0xff)]),_0x172960={'js':_0x36a8d9(0xf3),'vue':'vue-style.md','css':_0x36a8d9(0xed),'project':_0x36a8d9(0xfd)};if(_0x5c4513==='all'){let _0x33b7ee='';for(const _0x451393 of Object[_0x36a8d9(0xf7)](_0x172960)){_0x33b7ee+=_0x36a8d9(0xea)+_0x451393[_0x36a8d9(0x100)]()+_0x36a8d9(0xee)+getFileContent(_0xfabe4b,_0x172960[_0x451393]);}return _0x33b7ee;}const _0x2ae834=_0x172960[_0x5c4513];if(_0x2ae834)return getFileContent(_0xfabe4b,_0x2ae834);return'Unknown\x20standard\x20type.\x20Available\x20types:\x20js,\x20vue,\x20css,\x20project,\x20all';}function a3_0x43cf(_0x1b3f7a,_0x1eb69f){_0x1b3f7a=_0x1b3f7a-0xea;const _0x39b1b8=a3_0x586a();let _0x3fe268=_0x39b1b8[_0x1b3f7a];return _0x3fe268;}function getFileContent(_0x3e0d04,_0x10d4d0){const _0x56d744=a3_0x385026,_0x28140f=path_1[_0x56d744(0xfa)][_0x56d744(0xef)](_0x3e0d04,_0x10d4d0);if(fs_1[_0x56d744(0xfa)][_0x56d744(0xf8)](_0x28140f))return fs_1[_0x56d744(0xfa)]['readFileSync'](_0x28140f,'utf-8');return'Standard\x20file\x20not\x20found:\x20'+_0x10d4d0;}
|