Skip to content

Commit c0c353c

Browse files
committed
update v1.3.9
优化对 Zepto 的兼容(v1.3.8 需要 zepto data 模块支持)
1 parent 715df9f commit c0c353c

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ cxSelect 是基于 jQuery 的多级联动菜单插件,适用于省市、商品
1212

1313
**版本:**
1414

15-
* jQuery v1.7+
16-
* jQuery cxSelect v1.3.8
15+
* jQuery v1.7+ | Zepto v1.0+
16+
* jQuery cxSelect v1.3.9
1717

1818
文档:http://code.ciaoca.com/jquery/cxselect/
1919

@@ -95,7 +95,7 @@ $.cxSelect.defaults.nodata = 'none';
9595
<tr>
9696
<td>required</td>
9797
<td>false</td>
98-
<td>是否为必选。设为 flase 时,会在列表头部添加 `&lt;option value="firstValue"&gt;firstTitle&lt;/option&gt;` 选项。</td>
98+
<td>是否为必选。设为 false 时,会在列表头部添加 `&lt;option value="firstValue"&gt;firstTitle&lt;/option&gt;` 选项。</td>
9999
</tr>
100100
<tr>
101101
<td>firstTitle</td>

js/jquery.cxselect.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*!
22
* jQuery cxSelect
33
* @name jquery.cxselect.js
4-
* @version 1.3.8
5-
* @date 2015-12-7
4+
* @version 1.3.9
5+
* @date 2016-01-06
66
* @author ciaoca
77
* @email ciaoca@gmail.com
88
* @site https://github.com/ciaoca/cxSelect
@@ -83,8 +83,8 @@
8383
if (!_tempSelect) {break};
8484

8585
// 保存默认值
86-
if (typeof _tempSelect.val() === 'string') {
87-
_tempSelect.data('value', _tempSelect.val());
86+
if (typeof _tempSelect.val() === 'string' && _tempSelect.val().length) {
87+
_tempSelect.attr('data-value', _tempSelect.val());
8888
};
8989

9090
self.selectArray.push(_tempSelect);
@@ -102,7 +102,7 @@
102102
self.start();
103103

104104
// 设置 URL,通过 Ajax 获取数据
105-
} else if (typeof self.settings.url === 'string') {
105+
} else if (typeof self.settings.url === 'string' && self.settings.url.length) {
106106
$.getJSON(self.settings.url, function(json) {
107107
self.start(json);
108108
});
@@ -284,7 +284,7 @@
284284

285285
// 初次加载设置默认值
286286
if (typeof select.data('value') !== 'undefined') {
287-
select.val(String(select.data('value'))).removeData('value').removeAttr('data-value');
287+
select.val(String(select.data('value'))).removeAttr('data-value');
288288
};
289289

290290
select.trigger('change');

js/jquery.cxselect.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)