diff --git a/docs/markdown/quickstart.md b/docs/markdown/quickstart.md index 7260e6dd..db55c18a 100644 --- a/docs/markdown/quickstart.md +++ b/docs/markdown/quickstart.md @@ -31,13 +31,16 @@ npm i vant-weapp -S --production 如果你使用 typescript 开发小程序,需要在 tsconfig.json 中增加如下配置,防止 npm 构建后 tsc 编译报错 +请将`path/to/node_modules/@vant/weapp`修改为项目中 @vant/weapp 所在的目录 + ```json { - "baseUrl": ".", - "paths": { - "@vant/weapp/*": ["./node_modules/@vant/weapp/dist/*"] + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@vant/weapp/*": ["path/to/node_modules/@vant/weapp/dist/*"] + } } - ... } ``` @@ -59,21 +62,27 @@ npm i vant-weapp -S --production 以 Button 组件为例,只需要在`app.json`或`index.json`中配置 Button 对应的路径即可。如果你是通过下载源代码的方式使用 @vant/weapp,请将路径修改为项目中 @vant/weapp 所在的目录。 - - ```json // 通过 npm 安装 // app.json "usingComponents": { - "van-button": "@vant/weapp/button" + "van-button": "@vant/weapp/button/index" } ``` ```json -// 通过下载源码使用 +// 通过下载源码使用 es6版本 // app.json "usingComponents": { - "van-button": "path/to/@vant/weapp/dist/button" + "van-button": "path/to/@vant/weapp/dist/button/index" +} +``` + +```json +// 通过下载源码使用 es5版本 +// app.json +"usingComponents": { + "van-button": "path/to/@vant/weapp/lib/button/index" } ``` diff --git a/packages/action-sheet/README.md b/packages/action-sheet/README.md index 6ac450d4..0c5e3bf3 100644 --- a/packages/action-sheet/README.md +++ b/packages/action-sheet/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-action-sheet": "path/to/@vant/weapp/dist/action-sheet/index" + "van-action-sheet": "@vant/weapp/action-sheet/index" } ``` @@ -191,7 +191,7 @@ Page({ | disabled | 是否为禁用状态 | *boolean* | - | | className | 为对应列添加额外的 class 类名 | *string* | - | | openType | 微信开放能力,具体支持可参考 [微信官方文档](https://mp.weixin.qq.com/debug/wxadoc/dev/component/button.html) | *string* | - | -| lang | 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文 | *string* | `en` | +| lang | 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文 | *string* | `en` | | sessionFrom | 会话来源,openType="contact"时有效 | *string* | - | | sendMessageTitle | 会话内消息卡片标题,openType="contact"时有效 | *string* | 当前标题 | | sendMessagePath | 会话内消息卡片点击跳转小程序路径,openType="contact"时有效 | *string* | 当前分享路径 | diff --git a/packages/area/README.md b/packages/area/README.md index 318738ed..fca82ce2 100644 --- a/packages/area/README.md +++ b/packages/area/README.md @@ -10,7 +10,7 @@ ```json "usingComponents": { - "van-area": "path/to/@vant/weapp/dist/area/index" + "van-area": "@vant/weapp/area/index" } ``` diff --git a/packages/button/README.md b/packages/button/README.md index 537be3d7..4711b34d 100644 --- a/packages/button/README.md +++ b/packages/button/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-button": "path/to/@vant/weapp/dist/button/index" + "van-button": "@vant/weapp/button/index" } ``` diff --git a/packages/calendar/README.md b/packages/calendar/README.md index d826c61c..caaad85c 100644 --- a/packages/calendar/README.md +++ b/packages/calendar/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-calendar": "path/to/@vant/weapp/dist/calendar/index" + "van-calendar": "@vant/weapp/calendar/index" } ``` diff --git a/packages/card/README.md b/packages/card/README.md index 25cc85e0..8a6b9c16 100644 --- a/packages/card/README.md +++ b/packages/card/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-card": "path/to/@vant/weapp/dist/card/index" + "van-card": "@vant/weapp/card/index" } ``` diff --git a/packages/cell/README.md b/packages/cell/README.md index 2a1303ad..97c79b49 100644 --- a/packages/cell/README.md +++ b/packages/cell/README.md @@ -6,8 +6,8 @@ ```json "usingComponents": { - "van-cell": "path/to/@vant/weapp/dist/cell/index", - "van-cell-group": "path/to/@vant/weapp/dist/cell-group/index" + "van-cell": "@vant/weapp/cell/index", + "van-cell-group": "@vant/weapp/cell-group/index" } ``` diff --git a/packages/checkbox/README.md b/packages/checkbox/README.md index 73c8a74d..5058c104 100644 --- a/packages/checkbox/README.md +++ b/packages/checkbox/README.md @@ -5,8 +5,8 @@ ```json "usingComponents": { - "van-checkbox": "path/to/@vant/weapp/dist/checkbox/index", - "van-checkbox-group": "path/to/@vant/weapp/dist/checkbox-group/index" + "van-checkbox": "@vant/weapp/checkbox/index", + "van-checkbox-group": "@vant/weapp/checkbox-group/index" } ``` diff --git a/packages/circle/README.md b/packages/circle/README.md index bd4fdb17..8065107c 100644 --- a/packages/circle/README.md +++ b/packages/circle/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-circle": "path/to/@vant/weapp/dist/circle/index" + "van-circle": "@vant/weapp/circle/index" } ``` diff --git a/packages/col/README.md b/packages/col/README.md index 08faf29e..23213639 100644 --- a/packages/col/README.md +++ b/packages/col/README.md @@ -10,8 +10,8 @@ Layout 提供了`van-row`和`van-col`两个组件来进行行列布局 ```json "usingComponents": { - "van-row": "path/to/@vant/weapp/dist/row/index", - "van-col": "path/to/@vant/weapp/dist/col/index" + "van-row": "@vant/weapp/row/index", + "van-col": "@vant/weapp/col/index" } ``` diff --git a/packages/collapse/README.md b/packages/collapse/README.md index 0760d5e3..c169f034 100644 --- a/packages/collapse/README.md +++ b/packages/collapse/README.md @@ -5,8 +5,8 @@ ```json "usingComponents": { - "van-collapse": "path/to/@vant/weapp/dist/collapse/index", - "van-collapse-item": "path/to/@vant/weapp/dist/collapse-item/index" + "van-collapse": "@vant/weapp/collapse/index", + "van-collapse-item": "@vant/weapp/collapse-item/index" } ``` diff --git a/packages/common/README.md b/packages/common/README.md index 1275bc56..c0e38df8 100644 --- a/packages/common/README.md +++ b/packages/common/README.md @@ -9,7 +9,7 @@ Vant 中默认包含了一些常用样式,可以直接通过 className 的方 在 app.wxss 中引入内置样式 ```css -@import "path/to/@vant/weapp/dist/common/index.wxss"; +@import "@vant/weapp/common/index.wxss"; ``` ## 代码演示 diff --git a/packages/count-down/README.md b/packages/count-down/README.md index c379582f..65d19cc4 100644 --- a/packages/count-down/README.md +++ b/packages/count-down/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-count-down": "path/to/@vant/weapp/dist/count-down/index" + "van-count-down": "@vant/weapp/count-down/index" } ``` diff --git a/packages/datetime-picker/README.md b/packages/datetime-picker/README.md index ad84a3ce..5fe7dd21 100644 --- a/packages/datetime-picker/README.md +++ b/packages/datetime-picker/README.md @@ -10,7 +10,7 @@ ```json "usingComponents": { - "van-datetime-picker": "path/to/@vant/weapp/dist/datetime-picker/index" + "van-datetime-picker": "@vant/weapp/datetime-picker/index" } ``` diff --git a/packages/dialog/README.md b/packages/dialog/README.md index 5cb073c9..28c31406 100644 --- a/packages/dialog/README.md +++ b/packages/dialog/README.md @@ -12,7 +12,7 @@ ```json "usingComponents": { - "van-dialog": "path/to/@vant/weapp/dist/dialog/index" + "van-dialog": "@vant/weapp/dialog/index" } ``` diff --git a/packages/divider/README.md b/packages/divider/README.md index ab1a4a57..bf0ffe16 100644 --- a/packages/divider/README.md +++ b/packages/divider/README.md @@ -10,7 +10,7 @@ ```json "usingComponents": { - "van-divider": "path/to/@vant/weapp/dist/divider/index" + "van-divider": "@vant/weapp/divider/index" } ``` diff --git a/packages/dropdown-menu/README.md b/packages/dropdown-menu/README.md index 9535915e..d5890da8 100644 --- a/packages/dropdown-menu/README.md +++ b/packages/dropdown-menu/README.md @@ -6,8 +6,8 @@ ```json "usingComponents": { - "van-dropdown-menu": "path/to/@vant/weapp/dist/dropdown-menu/index", - "van-dropdown-item": "path/to/@vant/weapp/dist/dropdown-item/index" + "van-dropdown-menu": "@vant/weapp/dropdown-menu/index", + "van-dropdown-item": "@vant/weapp/dropdown-item/index" } ``` diff --git a/packages/field/README.md b/packages/field/README.md index ba2148ca..8ad33574 100644 --- a/packages/field/README.md +++ b/packages/field/README.md @@ -10,7 +10,7 @@ ```json "usingComponents": { - "van-field": "path/to/@vant/weapp/dist/field/index" + "van-field": "@vant/weapp/field/index" } ``` diff --git a/packages/goods-action/README.md b/packages/goods-action/README.md index 558c9ecb..041ec8cc 100644 --- a/packages/goods-action/README.md +++ b/packages/goods-action/README.md @@ -6,9 +6,9 @@ ```json "usingComponents": { - "van-goods-action": "path/to/@vant/weapp/dist/goods-action/index", - "van-goods-action-icon": "path/to/@vant/weapp/dist/goods-action-icon/index", - "van-goods-action-button": "path/to/@vant/weapp/dist/goods-action-button/index" + "van-goods-action": "@vant/weapp/goods-action/index", + "van-goods-action-icon": "@vant/weapp/goods-action-icon/index", + "van-goods-action-button": "@vant/weapp/goods-action-button/index" } ``` diff --git a/packages/grid/README.md b/packages/grid/README.md index 7bb4c778..75c9ac96 100644 --- a/packages/grid/README.md +++ b/packages/grid/README.md @@ -10,8 +10,8 @@ ```json "usingComponents": { - "van-grid": "path/to/@vant/weapp/dist/grid/index", - "van-grid-item": "path/to/@vant/weapp/dist/grid-item/index" + "van-grid": "@vant/weapp/grid/index", + "van-grid-item": "@vant/weapp/grid-item/index" } ``` diff --git a/packages/icon/README.md b/packages/icon/README.md index e7868dee..ba922be7 100644 --- a/packages/icon/README.md +++ b/packages/icon/README.md @@ -10,7 +10,7 @@ ```json "usingComponents": { - "van-icon": "path/to/@vant/weapp/dist/icon/index" + "van-icon": "@vant/weapp/icon/index" } ``` diff --git a/packages/image/README.md b/packages/image/README.md index 848acea3..4559b51d 100644 --- a/packages/image/README.md +++ b/packages/image/README.md @@ -10,7 +10,7 @@ ```json "usingComponents": { - "van-image": "path/to/@vant/weapp/dist/image/index" + "van-image": "@vant/weapp/image/index" } ``` diff --git a/packages/index-bar/README.md b/packages/index-bar/README.md index 02874e6c..a16c6ebb 100644 --- a/packages/index-bar/README.md +++ b/packages/index-bar/README.md @@ -6,8 +6,8 @@ ```json "usingComponents": { - "van-index-bar": "path/to/@vant/weapp/dist/index-bar/index", - "van-index-anchor": "path/to/@vant/weapp/dist/index-anchor/index" + "van-index-bar": "@vant/weapp/index-bar/index", + "van-index-anchor": "@vant/weapp/index-anchor/index" } ``` diff --git a/packages/loading/README.md b/packages/loading/README.md index 8368913f..2bed6184 100644 --- a/packages/loading/README.md +++ b/packages/loading/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-loading": "path/to/@vant/weapp/dist/loading/index" + "van-loading": "@vant/weapp/loading/index" } ``` diff --git a/packages/nav-bar/README.md b/packages/nav-bar/README.md index a3aecf9c..d9655768 100644 --- a/packages/nav-bar/README.md +++ b/packages/nav-bar/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-nav-bar": "path/to/@vant/weapp/dist/nav-bar/index" + "van-nav-bar": "@vant/weapp/nav-bar/index" } ``` diff --git a/packages/notice-bar/README.md b/packages/notice-bar/README.md index 818b39b8..33b32170 100644 --- a/packages/notice-bar/README.md +++ b/packages/notice-bar/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-notice-bar": "path/to/@vant/weapp/dist/notice-bar/index" + "van-notice-bar": "@vant/weapp/notice-bar/index" } ``` diff --git a/packages/notify/README.md b/packages/notify/README.md index 9892cb40..74a8d19d 100644 --- a/packages/notify/README.md +++ b/packages/notify/README.md @@ -5,7 +5,7 @@ ```json "usingComponents": { - "van-notify": "path/to/@vant/weapp/dist/notify/index" + "van-notify": "@vant/weapp/notify/index" } ``` diff --git a/packages/overlay/README.md b/packages/overlay/README.md index 2a984987..1336e1fb 100644 --- a/packages/overlay/README.md +++ b/packages/overlay/README.md @@ -10,7 +10,7 @@ ```json "usingComponents": { - "van-overlay": "path/to/@vant/weapp/dist/overlay/index" + "van-overlay": "@vant/weapp/overlay/index" } ``` diff --git a/packages/panel/README.md b/packages/panel/README.md index 04bd0206..b2f02bb9 100644 --- a/packages/panel/README.md +++ b/packages/panel/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-panel": "path/to/@vant/weapp/dist/panel/index" + "van-panel": "@vant/weapp/panel/index" } ``` diff --git a/packages/picker/README.md b/packages/picker/README.md index 26b25744..083a5263 100644 --- a/packages/picker/README.md +++ b/packages/picker/README.md @@ -9,7 +9,7 @@ ```json "usingComponents": { - "van-picker": "path/to/@vant/weapp/dist/picker/index" + "van-picker": "@vant/weapp/picker/index" } ``` diff --git a/packages/popup/README.md b/packages/popup/README.md index 96ae2218..8fb3935f 100644 --- a/packages/popup/README.md +++ b/packages/popup/README.md @@ -10,7 +10,7 @@ ```json "usingComponents": { - "van-popup": "path/to/@vant/weapp/dist/popup/index" + "van-popup": "@vant/weapp/popup/index" } ``` diff --git a/packages/progress/README.md b/packages/progress/README.md index e5d38890..b093cc8c 100644 --- a/packages/progress/README.md +++ b/packages/progress/README.md @@ -5,7 +5,7 @@ ```json "usingComponents": { - "van-progress": "path/to/@vant/weapp/dist/progress/index" + "van-progress": "@vant/weapp/progress/index" } ``` diff --git a/packages/radio/README.md b/packages/radio/README.md index 7860d4a2..cbc35eb0 100644 --- a/packages/radio/README.md +++ b/packages/radio/README.md @@ -6,8 +6,8 @@ ```json "usingComponents": { - "van-radio": "path/to/@vant/weapp/dist/radio/index", - "van-radio-group": "path/to/@vant/weapp/dist/radio-group/index" + "van-radio": "@vant/weapp/radio/index", + "van-radio-group": "@vant/weapp/radio-group/index" } ``` diff --git a/packages/rate/README.md b/packages/rate/README.md index dfe3772c..73877027 100644 --- a/packages/rate/README.md +++ b/packages/rate/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-rate": "path/to/@vant/weapp/dist/rate/index" + "van-rate": "@vant/weapp/rate/index" } ``` ## 代码演示 diff --git a/packages/search/README.md b/packages/search/README.md index 05248f67..fd880b6c 100644 --- a/packages/search/README.md +++ b/packages/search/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-search": "path/to/@vant/weapp/dist/search/index" + "van-search": "@vant/weapp/search/index" } ``` diff --git a/packages/sidebar/README.md b/packages/sidebar/README.md index dc409710..56385702 100644 --- a/packages/sidebar/README.md +++ b/packages/sidebar/README.md @@ -6,8 +6,8 @@ ```json "usingComponents": { - "van-sidebar": "path/to/@vant/weapp/dist/sidebar/index", - "van-sidebar-item": "path/to/@vant/weapp/dist/sidebar-item/index" + "van-sidebar": "@vant/weapp/sidebar/index", + "van-sidebar-item": "@vant/weapp/sidebar-item/index" } ``` diff --git a/packages/skeleton/README.md b/packages/skeleton/README.md index 292f6c18..e3f225e1 100644 --- a/packages/skeleton/README.md +++ b/packages/skeleton/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-skeleton": "path/to/@vant/weapp/dist/skeleton/index" + "van-skeleton": "@vant/weapp/skeleton/index" } ``` diff --git a/packages/slider/README.md b/packages/slider/README.md index fec80d3d..70421ee7 100644 --- a/packages/slider/README.md +++ b/packages/slider/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-slider": "path/to/@vant/weapp/dist/slider/index" + "van-slider": "@vant/weapp/slider/index" } ``` diff --git a/packages/stepper/README.md b/packages/stepper/README.md index fc063d0e..36b00dd7 100644 --- a/packages/stepper/README.md +++ b/packages/stepper/README.md @@ -10,7 +10,7 @@ ```json "usingComponents": { - "van-stepper": "path/to/@vant/weapp/dist/stepper/index" + "van-stepper": "@vant/weapp/stepper/index" } ``` diff --git a/packages/steps/README.md b/packages/steps/README.md index b700e7fc..f51609a9 100644 --- a/packages/steps/README.md +++ b/packages/steps/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-steps": "path/to/@vant/weapp/dist/steps/index" + "van-steps": "@vant/weapp/steps/index" } ``` diff --git a/packages/sticky/README.md b/packages/sticky/README.md index 5503d4a1..e48c953c 100644 --- a/packages/sticky/README.md +++ b/packages/sticky/README.md @@ -10,7 +10,7 @@ Sticky 组件与 CSS 中`position: sticky`属性实现的效果一致,当组 ```json "usingComponents": { - "van-sticky": "path/to/@vant/weapp/dist/sticky/index" + "van-sticky": "@vant/weapp/sticky/index" } ``` diff --git a/packages/submit-bar/README.md b/packages/submit-bar/README.md index 94222af3..7256eab5 100644 --- a/packages/submit-bar/README.md +++ b/packages/submit-bar/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-submit-bar": "path/to/@vant/weapp/dist/submit-bar/index" + "van-submit-bar": "@vant/weapp/submit-bar/index" } ``` diff --git a/packages/swipe-cell/README.md b/packages/swipe-cell/README.md index 3ab4e655..32df348c 100644 --- a/packages/swipe-cell/README.md +++ b/packages/swipe-cell/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-swipe-cell": "path/to/@vant/weapp/dist/swipe-cell/index" + "van-swipe-cell": "@vant/weapp/swipe-cell/index" } ``` diff --git a/packages/switch/README.md b/packages/switch/README.md index 64550777..8564ba07 100644 --- a/packages/switch/README.md +++ b/packages/switch/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-switch": "path/to/@vant/weapp/dist/switch/index" + "van-switch": "@vant/weapp/switch/index" } ``` diff --git a/packages/tab/README.md b/packages/tab/README.md index 6f24f3d2..fb0ff618 100644 --- a/packages/tab/README.md +++ b/packages/tab/README.md @@ -6,8 +6,8 @@ ```json "usingComponents": { - "van-tab": "path/to/@vant/weapp/dist/tab/index", - "van-tabs": "path/to/@vant/weapp/dist/tabs/index" + "van-tab": "@vant/weapp/tab/index", + "van-tabs": "@vant/weapp/tabs/index" } ``` diff --git a/packages/tabbar/README.md b/packages/tabbar/README.md index 5b387c52..55295923 100644 --- a/packages/tabbar/README.md +++ b/packages/tabbar/README.md @@ -6,8 +6,8 @@ ```json "usingComponents": { - "van-tabbar": "path/to/@vant/weapp/dist/tabbar/index", - "van-tabbar-item": "path/to/@vant/weapp/dist/tabbar-item/index" + "van-tabbar": "@vant/weapp/tabbar/index", + "van-tabbar-item": "@vant/weapp/tabbar-item/index" } ``` diff --git a/packages/tag/README.md b/packages/tag/README.md index 452f8732..3f11481e 100644 --- a/packages/tag/README.md +++ b/packages/tag/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-tag": "path/to/@vant/weapp/dist/tag/index" + "van-tag": "@vant/weapp/tag/index" } ``` diff --git a/packages/toast/README.md b/packages/toast/README.md index 96a84cf0..c1778dff 100644 --- a/packages/toast/README.md +++ b/packages/toast/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-toast": "path/to/@vant/weapp/dist/toast/index" + "van-toast": "@vant/weapp/toast/index" } ``` diff --git a/packages/transition/README.md b/packages/transition/README.md index 73f082db..d954fb20 100644 --- a/packages/transition/README.md +++ b/packages/transition/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-transition": "path/to/@vant/weapp/dist/transition/index" + "van-transition": "@vant/weapp/transition/index" } ``` diff --git a/packages/tree-select/README.md b/packages/tree-select/README.md index 0b57ab5e..1876fee2 100644 --- a/packages/tree-select/README.md +++ b/packages/tree-select/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-tree-select": "path/to/@vant/weapp/dist/tree-select/index" + "van-tree-select": "@vant/weapp/tree-select/index" } ``` diff --git a/packages/uploader/README.md b/packages/uploader/README.md index ba134e93..569550ea 100644 --- a/packages/uploader/README.md +++ b/packages/uploader/README.md @@ -6,7 +6,7 @@ ```json "usingComponents": { - "van-uploader": "path/to/@vant/weapp/dist/uploader/index" + "van-uploader": "@vant/weapp/uploader/index" } ```