首先就是引入distpicker的相關js,具體樣式的話可以根據自己想要的去調。
主要實現的功能是:選擇省市區,獲取到對應的省市區code和name,並展示到對應的dom元素中提取碼:ma**
1、頁面**
lang
="en"
>
>
charset
="utf-8"
>
name
="viewport"
content
="width=device-width,initial-scale=1.0,user-scalable=no"
>
>
位址填寫頁面title
>
rel=
"stylesheet"
href
="css/pub.css"
>
>
.address_container
.address_form
.address_form .cell
.address_form .cell .title
.address_form .cell .title i
.address_form .cell input
.address_form .cell #address
.address_form form
.address_form .submit
.picker_box
.picker_box>div
.picker_box select
.picker_box select option
style
>
head
>
>
class
="address_container"
>
class
="address_pic"
>
src=
"images/address_title.png"
alt="
">
div>
class
="address_form"
>
action="
" id
="form"
>
class
="cell"
>
class
="title"
>
>
src=
"images/address_address.png"
alt="
">
i>
for=
"checkadress"
>
選擇位址label
>
div>
type
="text"
id="checkadress"
name
="checkadress"
placeholder
="請選擇市/區/縣"
readonly="
">
class
="picker_box"
>
data-toggle
="distpicker"
id="distpicker"
>
class
="distpicker_cover"
>
>
省span
>
>
市span
>
>
區span
>
div>
"eprovincename"
data-province
="省"
name
="provincename"
>
select
>
"ecityname"
data-city
="市"
name
="cityname"
>
select
>
"edistrictname"
data-district
="區"
name
="districtname"
>
select
>
div>
div>
div>
class
="cell"
>
class
="title"
>
for=
"address"
>
詳細位址label
>
div>
type
="text"
id="address"
name
="address"
placeholder
="請輸入具體位址,例如:街道/小區/門牌"
>
div>
form
>
class
="submit"
>
提交div
>
div>
div>
src=
"js/jquery-3.4.1.min.js"
>
script
>
src=
"js/distpicker.data.js"
>
script
>
src=
"js/distpicker.min.js"
>
script
>
>
$(document)
.ready
(function()
;//位址選擇事件
dispicker()
function
dispicker()
})$(
'#ecityname').
click
(function()
})$(
'#edistrictname').
click
(function()
})}// 提交表單
submit()
function
submit()
})formdata.provinceid = provinceid
formdata.cityid = cityid
formdata.districtid = districtid
console.
log(formdata)})
}})script
>
body
>
html
>
現在還有乙個問題,就是,會報錯,哪位大佬知道什麼原因的話,感謝指教 jquery的顏色選擇外掛程式
忙了一夜,終於把jquery的顏色選擇外掛程式寫完了,不多說了,看看 吧。function return index var colorh new array 00 33 66 99 cc ff var scolorh new array ff0000 00ff00 0000ff ffff00 00...
uniapp仿京東位址選擇外掛程式
匯入外掛程式之後,會在components下生成以下的檔案 然後只需要根據自己的需求改vue檔案即可,在所需的頁面寫以下的 content text area click btnclick title v if ishows 請選擇 title v if ishowstitle selectaddr...
flutter外掛程式位址
根據官方介紹 他是乙個簡單的關係型嵌入式的應用資料庫 用於顫振的sqlite外掛程式。支援ios,android和macos。乙個用於查詢檔案系統上常用位置的flutter外掛程式。支援ios和android。這是乙個包含預設圖示資產的資產回購,由flutter的cupertino widgets使...