<script src="/city-picker/city-picker.data.js"></script> <link href="/city-picker/city-picker.css" rel="stylesheet" />
<div class="layui-form-item"> <label class="layui-form-label">寄件地址</label> <div class="layui-input-block"> <input type="text" autocomplete="on" class="layui-input" id="city-picker1" name="city-picker" readonly="readonly" data-toggle="city-picker" placeholder="请选择"> </div> </div>
<script > layui.use([ 'laydate', 'laypage', 'layer', 'table', 'carousel', 'upload', 'element' ], function() { var laydate = layui.laydate //日期 , laypage = layui.laypage //分页 , layer = layui.layer //弹层 , table = layui.table //表格 , carousel = layui.carousel //轮播 , upload = layui.upload //上传 , element = layui.element; //元素操作 layui.config({ base: '/city-picker/' //静态资源所在路径 }).extend({ citypicker: '{/}/city-picker/city-picker' // {/}的意思即代表采用自有路径,即不跟随 base 路径 }).use(['jquery', 'table', 'citypicker'], function () { var $ = layui.$ , table = layui.table , form = layui.form , cityPicker = layui.citypicker; var currentPicker = new cityPicker("#city-picker1", { provincename:"provinceId", cityname:"cityId", districtname: "districtId", level: 'districtId',// 级别 }); var currentPicker2 = new cityPicker("#city-picker2", { provincename: "provincenameid2", cityname: "citynameid2", districtname: "districtnameid2" }); var edit = [[${edit}]] if(edit){ currentPicker.setValue("[[${order?.address1}]]"); currentPicker2.setValue("[[${order?.address2}]]"); } }); }); </script>
可以在后后设置 edit
/** * /houtai/order/add */ @RequestMapping("/add") public ModelAndView add() throws Exception { ModelAndView mav = new ModelAndView(); mav.setViewName("/admin/page/order/add_update.html"); mav.addObject("btn_text", "添加"); mav.addObject("edit", false); mav.addObject("save_url", "/admin/order/add"); return mav; }
站长微信:xiaomao0055
站长QQ:14496453