### 需求 :online表单使用JS增强配置省市区下拉联动 ### 步骤: #### 1.新建一个空的数据字典,字典项名称为空,数据值打个空格就可以录入了 ![](https://img.kancloud.cn/ea/48/ea482f98385cfb1d0f60280c12a88c25_1661x316.png) #### 2.找到一个online配置表,新增3个字段,pro,city,area,配置如下, 必须配置下拉,且字典code一定要写 ![](https://img.kancloud.cn/e2/62/e262e1e4c4ba8fd2641d71969f4eb4b3_1330x427.png) ![](https://img.kancloud.cn/b5/e8/b5e8601abba49b59b3a4137beebe3373_1048x441.png) ![](https://img.kancloud.cn/d5/f4/d5f46a478c6bc26cb4a2a30abb1b4b5e_1266x453.png) 3.编写js增强: ``` //示例中数据写死,实际需要自己写请求, loaded(){ that.changeOptions('pro',[ {value:'1',text:'安徽省'}, {value:'2',text:'河南省'} ]) } onlChange(){ return { pro(){ let value = event.value let cityOptions = [] if(value=='2'){ cityOptions = [{text:'郑州市',value:'2-1'},{text:'开封市',value:'2-2'}] }else{ cityOptions = [{text:'合肥市',value:'1-1'},{text:'芜湖市',value:'1-2'}] } that.changeOptions('city',cityOptions); } city(){ let value = event.value let areaOptions = [] if(value=='1-1'){ areaOptions= [{text:'包河区',value:'1-1-1'},{text:'临江县',value:'1-1-2'}] }else{ areaOptions= [{text:'其他区',value:'xxx'},{text:'其他县',value:'xxxxx'}] } that.changeOptions('area',areaOptions); } } } ``` 4.测试效果 ![](https://img.kancloud.cn/82/9a/829a43b53a5b779b1cb7f94d62eaad38_808x439.png)