xfhxbb / larea Goto Github PK
View Code? Open in Web Editor NEWLArea移动端城市选择控件
License: MIT License
LArea移动端城市选择控件
License: MIT License
使用浏览器或部分手机时, 页面 取消 完成 与 地址选择出现点什么都无响应的假死状态. 没有报任何错误, 这个如何处理... 只是部分, 并非全部.
虽然input设置了readonly;但是还是会呼出按键;所以把呼出的dom换成span或者其他的文本标签,然后修改finish函数中_self.trigger.value = provinceText + ((cityText)?(',' + cityText):(''))+ ((countyText)?(',' + countyText):(''));
为_self.trigger.inneHTML = provinceText + ((cityText)?(',' + cityText):(''))+ ((countyText)?(',' + countyText):(''));
这样就避免了呼出时按键出现的情况
建议调用方式可以如下:
var area=new LArea();
area.config(options);
//执行事件再调用,以JQ语法举例:
$(".a").click(function(){
//执行请求获得城市数据data
......
area.init(data,function(res){
//回调在点确定的时候触发,res里返回选中城市的id和name
});
});
config可以灵活配置一些样式或者为以后添加功能预留,加入回调可以灵活的使用在所有场景,城市的数据一般从服务器获取,我觉得没必要写在插件里啦。还有最好能在config里配置接口的格式,都写死了id,name,child就不灵活啦。还有要是可以第一次init的时候滚到当前城市就好了,这个建议可以在config里或者init的时候传入当前城市添加。
最后,谢谢写了这个插件。
希望能有个扩展性,如:这个插件可以是一级、二级、三级的
中间滑动 右面会跟着联动....快速滑动右面会有这个错误,求解
Uncaught TypeError: Cannot read property 'nodeType' of undefined
at attr (jquery-1.11.3.js:7946)
at jQuery.access (jquery-1.11.3.js:4182)
at jQuery.fn.init.attr (jquery-1.11.3.js:7933)
at LArea.js:359
在170行添加上这个判断就能解决点击报错
if(isNaN(flag)){
return ;
}
如何只显示省和市 不显示区域。
在用户知识单击时,不会产生记录target["new_"+target.id]跟target["n_t"+target.id],及不会执行touchmove事件,导致错误
bug1.触发点击事件的时候持续报错
bug2.滚动没有结束的时候点击取消持续报错
LArea.js:335 Uncaught TypeError: Cannot read property 'textContent' of undefined
/**
185行: 需要调整为
var flag = (target["new_" + target.id] - target["old_" + target.id]) / (target["n_t_" + target.id] - target["o_t_" + target.id]) || 0;
选择后绑定change事件发现value的值没变
在滑块弹出后如果直接在最后一列的地址上单击就会不停的报错
希望这个问题能得到解决
LArea.js:285 Uncaught TypeError: Cannot read property 'id' of undefined
大神你注释很多但是小弟只能略懂一二 求解! 么么哒~
建议确定后增加回调函数,数据能否直接引用json文件
area1.init({
'data': 'js/AreaData.json' ,//数据源
callback:function(id,value)(){}
});
请问如何重设数据。我想增加一个按钮,点击就重设数据为[0,0,0]。
bug是这样的:
A省有10个市
B省有5个市
选中A省,把市拖到最后一个
再选择B省,点击确定,就会报这个错了。
貌似市元素的位置没有重置。
每次滑动就连续报错
1112
LArea.js:277 Uncaught TypeError: Cannot read property 'querySelectorAll' of null
LArea.js:334 Uncaught TypeError: Cannot read property 'textContent' of undefined
20LArea.js:285 Uncaught TypeError: Cannot read property 'id' of undefined
怎么破?
LArea.js:277 Uncaught TypeError: Cannot read property 'querySelectorAll' of null
at MobileArea.setGearTooth (LArea.js:277)
at setGear (LArea.js:244)
at LArea.js:229
input value="默认值",另一个 input value="默认值ID";点击弹出选择层,默认值没有选中,选中的是其他值
点击的时候代码一直运行报错并且无法确定选择的地区
你好,我遇到一个问题,我需要在选择地址之后能监控到该文本框发生了变化,但是常规的一些方法change onchange都不能用,因为他们需要失去焦点才会触发。请问我应该怎么监控该选择器呗重新选择了 ,多谢。
找到解决方法了
$('input[name="demo2"]').bind('input propertychange', function() {
alert(123123);
});
可以监控通过js改变的value值 。 谢谢。
这个项目作者还有维护吗?
我的这个问题只在个别手机上面会出现省市区文字排版杂乱的问题,有人解决了这个问题了吗?
如题
1.code为什么还是几个月以前呢???
RT
finish后,不应该 document.body.removeChild(_self.gearArea);
_self.gearArea=null;
应该判断,页面中无gearArea的话popupArea方法,有gearArea用display:none,来控制选择控件的显示与否。
ios 跟安卓的 都不支持啊?掉不起来
很急,希望得到解决
huawei6,vivo Y67客户端滑动省,市和区,不会改变,而且市和区也不能滑动
在网页版里,微信和浏览器里都没问题,IOS也没有问题,只有安卓部分机型有问题
Uncaught TypeError: Cannot read property 'querySelectorAll' of null
at MobileArea.setGearTooth (LArea.js:277)
at setGear (LArea.js:244)
at LArea.js:229
在三星手机上此插件显示的为马塞克,怎么回事
andriod端选中项目上下没有渐变遮罩的效果 -webkit-mask好像没有生效,andriod4.2到andriod5.1的所以pad都不行。但是在chorme里面模拟的移动端是有遮罩效果的。
联系方式qq:281886917
能不能直接遍历后台传回来的数据,不经过json文件
$('input[readonly]').on('focus', function() {
$(this).trigger('blur');
});
为了兼容写了这个属性。掉不起来
样式里的行高可以调整,问题是如何调整LArea.js里面的哪个参数呢?
比如原来每一行的行高是2em, 我现在改成3rem, 问题是滑动后无法停留在一行,求教LArea.js里面改动哪个参数?
"id": "2",
"name": "东二区",
"units": [
{
"id": "1008",
"name": "7号楼",
"units": [
{
"id": "5020",
"name": "1单元",
"select":"false"
}, {
"id": "5021",
"name": "2单元",
"select":"false"
}, {
"id": "5022",
"name": "3单元",
"select":"false"
}]
},
这代码里面有两个units是一样的才能进行联动,但是我现在想要把第一个units改成buildings,第二个还是用units....在js里面要如何改????????
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.