# 選擇城市插件
[TOC]
## UICityList插件
> 應用**UICityList**第三方模塊
注:resource屬性的文件路徑
~~~
UICityList = api.require('UICityList');
UICityList.open({
rect: {
x: 0,
y: headerH,
w: api.winWidth,
h: api.winHeight - headerH
},
resource: 'widget://res/cityList.json',
styles: {
searchBar: {
bgColor: '#696969',
cancelColor: '#E3E3E3'
},
location: {
color: '#696969',
size: 12
},
sectionTitle: {
bgColor: '#eee',
color: '#000',
size: 12
},
item: {
bgColor: '#fff',
activeBgColor: '#696969',
color: '#000',
size: 14,
height: 40
},
indicator: {
bgColor: '#fff',
color: '#696969'
}
},
currentCity: cName,
locationWay: 'GPS',
placeholder: '輸入城市名或首字母查詢'
}, function(ret, err) {
if (ret.eventType == 'selected') {
changeCity = ret.cityInfo.city;
$api.rmStorage('cityName'); //刪除原來的城市名稱
$api.setStorage('cityName',changeCity); //更新城市名稱存入緩存
api.sendEvent({
name: 'changeCity',
});
api.closeWin();
}
});
~~~
## **UIActionSelector**
>UIActionSelector城市選擇模塊
注:resource屬性的文件路徑
~~~
UIActionSelector = api.require('UIActionSelector');
function fnOpenSelect() {
UIActionSelector.open({
datas : 'widget://res/city.json',
layout : {
row : 5,
col : 3,
height : 30,
size : 12,
sizeActive : 14,
rowSpacing : 5,
colSpacing : 10,
maskBg : 'rgba(0,0,0,0.2)',
bg : '#fff',
color : '#888',
colorActive : '#f00',
colorSelected : '#f00'
},
animation : true,
cancel : {
text : '取消',
size : 12,
w : 90,
h : 35,
bg : '#fff',
bgActive : '#ccc',
color : '#888',
colorActive : '#fff'
},
ok : {
text : '確定',
size : 12,
w : 90,
h : 35,
bg : '#fff',
bgActive : '#ccc',
color : '#888',
colorActive : '#fff'
},
title : {
text : '請選擇',
size : 12,
h : 44,
bg : '#eee',
color : '#888'
},
fixedOn : api.frameName
}, function(ret, err) {
if (ret) {
if (ret.level3 == null) {
var region = ret.level1 + ret.level2;
$api.val($api.byId('region'), region);
}else{
var region = ret.level1 + ret.level2 + ret.level3;
$api.val($api.byId('region'), region);
$api.val($api.byId('region1'), region);
$api.val($api.byId('region2'), region);
$api.val($api.byId('region3'), region);
$api.val($api.byId('region4'), region);
$api.val($api.byId('region5'), region);
}
} else {
alert(JSON.stringify(err));
}
});
}
~~~
- 關于我們
- ApiCloud
- 支付模塊
- 微信支付--wxPay(客戶端)
- 微信支付--wxPay(服務端)
- 支付寶支付--aliPay(客戶端配置)
- 支付寶支付--aliPay(服務端配置)
- DoT模板
- 緩存模塊
- 監聽模塊
- 百度定位模塊
- 設置狀態欄字體顏色
- 選擇城市插件
- 跨頁面執行方法
- 安卓-點擊返回事件
- 上傳圖片模塊
- 點擊彈出放大圖片層
- 魅族手機apiready問題
- 分享
- 跨win或frm執行腳本
- 關于ios數字自動識別成手機號
- 百度地圖bMap
- 語音識別模塊
- tabBarMenu底部導航
- 第三方登錄
- QQ網站和appQQ賬號的統一問題解決
- 微信登錄
- QQ登錄
- 微博登錄
- 上拉加載、下拉刷新模塊
- 圖片緩存
- 文件和圖片緩存機制分享
- PHP
- 支付寶及時到賬
- no input file specified報錯解決
- thinkphp 整合kindeditor
- 整合tpshop微信模塊到thinkcmf中
- thinkphp3.1.3整合支付寶
- 網站接入QQ OAuth2.0登錄教程
- ThinkPHP整合百度編輯器Ueditor
- PHP加快執行效率的寫法規范
- ThinkPHP操作大全
- PHP操作大全
- Thinkphp中SQL操作返回值
- php5.3 foreach 使用&(與運算符)引用賦值要注意的問題
- mysql給字段追加值
- 阿里大魚短信平臺接入
- Navicat 導出 Mysql 數據字典
- php 面向對象全面教程
- PHP5下調用SOAP
- PHP處理時間格式添加空格
- 偽裝URL請求(.htaccess)
- url請求參數加解密
- JS插件
- artDialog彈窗-頁面傳值
- jQuery點擊遮罩彈出層固定居中
- jeBox原生彈窗
- bxslider輪播
- js生成指定位數隨機數
- 發送短信倒計時
- js調試
- jQuery.validator 表單驗證規則
- Swiper 輪播
- 獲得焦點時-圖片抖動
- uploadify無刷新上傳圖片
- 導航下拉隱藏上拉顯示
- 獲得焦點時-加黑色蒙版
- jquery.qrcode.js生成二維條形碼(支持中文)
- jquery.qrcode.js生成二維條形碼(官方不支持中文)
- nth-child 選擇器
- 無刷新點擊實現加載更多數據
- 刷新頁面方法
- 判斷滾動條向上向下
- 跨瀏覽器復制jQuery-zclip
- js校驗表單后提交表單的三種方法
- 用JS判斷下拉框是否選中
- div中滾動
- 提交時彈出模態框
- 當圖片不顯示時替換方法
- 前端
- CSS3
- HTML5
- css技巧
- 移動端rem
- Flex布局
- 電商詳情滾動條監聽
- VueCircleMenu圓環按鈕
- iframe自適應頁面高度
- 百度Echart
- input:radio改變選中顏色
- Jquery
- 響應式布局基本實現Media Query
- 循環輸出只輸出新內容
- 小程序
- wx.request坑
- 概要
- git操作
- 本地記住密碼
- 操作
- 生成ssh公鑰 記住密碼
- git避坑
- ES6學習手札
- 調試小插件
- 谷歌插件Postman
- PHP調試助手
- WordPress
- 緩存服務器Redis
- 在線代碼運行 Docker
- 在ubuntu下怎樣安裝https
- BrowserSync 瀏覽器同步測試工具
- getmarkman高效的設計稿標注、測量工具
- PHPstrom軟件
- 服務器
- linux 安裝搭建服務器配置及nginx配置
- tpshop的nginx 服務器配置方法
- (服務器訪問文件404解決辦法)IIS 之 添加MIME擴展類型及常用的MIME類型列表
- mysql部分
- mysql緩存
- MySql監控工具--mytop
- MySql主從搭建
- mysql優化
- Mysql 復制 (主從復制)
- iOS開發筆記 - 上線流程
- VUE避坑指南
- 從零開始學Vue
- Vue-cli
- Webpack
- VUE小記
- npm打包空白
- 打包背景圖片/項目圖片不顯示
- VUE避坑指南/elementUI upload 自定義http-request上傳
- 關于watch監聽路由重復加載方法
- 解決加載內容的時候閃動問題
- vuecli沒有network訪問地址
- python學習
- python初始
- pytho內置函數大全
- win10 播放器播放TS文件問題
- 設計網站
- VUE避坑指南/VUE-CLI部署空白
- swiper使用問題
- uni-app學習手冊
- 目錄結構
- layUI
- nodesass版本sassloader版本問題