diff --git a/apps/partial/views/action/index.hbs b/apps/partial/views/action/index.hbs index 9670053..83f2b4c 100644 --- a/apps/partial/views/action/index.hbs +++ b/apps/partial/views/action/index.hbs @@ -100,16 +100,6 @@ <p class="title">9. 分页组件</p> <div style="border: 1px solid #000; height: 200px; padding: 5px;"> - <pre> - 全局安装json-server - - npm i -g json-server - - 启动 - - json-server --watch mock/address.json - - </pre> {{{ pagination paginationOpts }}} </div> @@ -161,6 +151,7 @@ <p style="margin-top: 20px;">14. 区域/选择地址组件</p> <div style="padding: 5px; height: 300px;"> + <p>使用手册详见yohoblk/public/js/plugins/README.md</p> <div id="address"></div> </div> diff --git a/public/js/plugins/README.md b/public/js/plugins/README.md new file mode 100644 index 0000000..8405709 --- /dev/null +++ b/public/js/plugins/README.md @@ -0,0 +1,37 @@ +### 组件使用手册 + +1. 地址选择组件 + + 全局安装json-server模拟服务端返回数据 + + npm i -g json-server + + 启动 + + json-server --watch mock/address.json + + API使用: + + var address = cascadingAddress({ + el: '#address', + url: 'http://localhost:3000/areas/0', + resource: 'areas' + }); + + 获取选择地址文本: + + address.getAreaLabels() + + 获取选择地址areaId: + + address.getAreaIds() + + 设置地址: + + address.setAddress({ + province: '32', // 省 + city: '3201', // 市 + dist: '320102' // 区县 + }); + + 开发者: 董金虎