src/main/webapp/assets/common/module/city-picker/city-picker.js
(开头部分) 21KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
layui.define(['jquery'], function (exports) {
var $ = layui.$;
'use strict';
if (typeof ChineseDistricts === 'undefined') {
throw new Error('The file "city-picker.data.js" must be included first!');
}
var NAMESPACE = 'citypicker';
var EVENT_CHANGE = 'change.' + NAMESPACE;
// 城市选择类
var CityPicker = function (element, options) {
this.PROVINCE = 'provinceId';
this.CITY = 'cityId';
this.DISTRICT = 'districtId';
this.$element = $(element);
this.$dropdown = null;
this.options = $.extend({}, CityPicker.DEFAULTS, $.isPlainObject(options) && options);
this.active = false;
this.dems = [];
this.needBlur = false;
this.init();
};
CityPicker.prototype = {
constructor: CityPicker,
init: function () {
this.defineDems();
this.render();
this.bind();
this.active = true;
var _this = this;
$(".icon_ca").on('click', function () {
$("#" + this.PROVINCE).val();
$("#" + this.CITY).val();
$("#" + this.DISTRICT).val();
_this.reset();
});
},
render: function () {
var p = this.getPosition(),
placeholder = this.$element.attr('placeholder') || this.options.placeholder,
textspan = '<span class="city-picker-span" style="' +
this.getWidthStyle(p.width) + 'height:' +
(p.height - 2) + 'px;line-height:' + (p.height - 1) + 'px;">' +
(placeholder ? '<span class="placeholder">' + placeholder + '</span>' : '') +
'<span class="title"></span><div class="arrow"></div>' + '<i class="icon_ca"></i></span>',
dropdown = '<div class="city-picker-dropdown" style="left:0px;top:100%;' +
this.getWidthStyle(p.width, true) + '">' +
'<div class="city-select-wrap">' +
'<div class="city-select-tab">' +
'<a class="active" data-count="' + this.PROVINCE + '">省份</a>' +
(this.includeDem(this.CITY) ? '<a data-count="' + this.CITY + '">城市</a>' : '') +
(this.includeDem(this.DISTRICT) ? '<a data-count="' + this.DISTRICT + '">区县</a>' : '') + '</div>' +
'<div class="city-select-content">' +
'<div class="city-select province ' + this.PROVINCE + '" data-count="' + this.PROVINCE + '"></div>' +
(this.includeDem(this.CITY) ? '<div class="city-select ' + this.CITY + '" data-count="' + this.CITY + '"></div>' : '') +
(this.includeDem(this.DISTRICT) ? '<div class="city-select ' + this.DISTRICT + '" data-count="' + this.DISTRICT + '"></div>' : '') +
后面还有 525 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。