Comments (5)
附上我的js文件
//= require jquery
//= require jquery.turbolinks
//= require jquery_ujs
//= require bootstrap
//= require 'china_city/jquery.china_city'
//= require nprogress
//= require message-bus
//= require jquery.qrcode.min
//= require bootstrap-notify.min
//= require turbolinks
window.App = {
current_merchant_id: null,
access_token: '',
isLogined: function() {
return App.current_merchant_id !== null;
}
};
NProgress.configure({
speed: 300,
minimum: 0.03,
ease: 'ease'
});
$(document).on('page:fetch', function() { NProgress.start(); });
$(document).on('page:change', function() {
NProgress.done();
MessageBus.start(); // call once at startup
// how often do you want the callback to fire in ms
MessageBus.callbackInterval = 500;
MessageBus.subscribe("/notifications_count/" + App.access_token, function(data){
// data shipped from server
var div, link, new_title, span, url;
span = $(".notification-count span");
link = $(".notification-count a");
new_title = document.title.replace(/^\(\d+\) /, '');
if (data.count > 0) {
span.show();
new_title = "(" + data.count + ") " + new_title;
link.addClass("new");
$.notify({
title: "<strong>" + data.title + "</strong> ",
message: "您有新订单(" + data.content + "),请赶快处理 <a href=\"" + data.content_path + "\">点击这里</a>"
},{
delay: 10000
});
} else {
span.hide();
link.removeClass("new");
}
span.text(data.count);
return document.title = new_title;
});
});
$(document).on('page:restore', function() { NProgress.remove(); });
from china_city.
经过测试,问题出现在两处地方
$("option:gt(0)", next_selects).remove() 这一句会导致option残留一些错误数据
以下的data是错误的,因为后台返回的json是{city_data:[...]}
data = data.data if data.data?
next_selects.first()[0].options.add(new Option(option[0], option[1])) for option in data
应该改为
for option in data.city_data
from china_city.
不知道为什么要关闭这个问题,现在0.0.4版本还是有问题呀。
from china_city.
@bingxie 你按照我的方法修改就行了,可能作者太忙
from china_city.
我也遇到这个问题,希望作者能够抽出一些时间,或者开放修改。谢谢。
from china_city.
Related Issues (20)
- 每个城市下面都有一个「市辖区」 HOT 1
- 请问这个gem怎么使用啊? HOT 1
- 是否可增加街道信息 HOT 1
- To update datasource:db/areas.json HOT 3
- 插件出错,选择省份后面数据不对应
- 修改省份后,之前的选择城市还保留在选择列表里面 HOT 5
- LoadError: cannot load such file -- gb2260 HOT 3
- 无法选择街道 HOT 1
- 有 id 重合
- 请问怎么避免出现“市辖区” HOT 1
- 是否考虑增加上“港澳台”地区的选择功能呢?现在还不能选择这些地区
- 有没有simple_form版本的例子
- China_city 不支持 jquery4 HOT 1
- js经常会莫名其妙和其它js框架冲突的问题
- Please release newest code to rubygems.
- 默认值设置错误 HOT 1
- 不能从汉字到编码??? HOT 1
- 看到好像有0.0.6版本,但是不支持rails 5以上?
- 使用Bootstrap,在小屏模式下不能选择地址。
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from china_city.