|
|
@@ -1,5 +1,8 @@
|
|
|
(function(vc){
|
|
|
vc.extends({
|
|
|
+ propTypes: {
|
|
|
+ parentModal:vc.propTypes.string
|
|
|
+ },
|
|
|
data:{
|
|
|
floorSelect2Info:{
|
|
|
floors:[],
|
|
|
@@ -9,14 +12,14 @@
|
|
|
}
|
|
|
},
|
|
|
_initMethod:function(){
|
|
|
+ vc.component._initFloorSelect2();
|
|
|
|
|
|
},
|
|
|
_initEvent:function(){
|
|
|
-
|
|
|
- vc.on('floorSelect2','_initFloorSelect2',function (_param) {
|
|
|
- vc.component._initFloorSelect2();
|
|
|
- });
|
|
|
-
|
|
|
+ //监听 modal 打开
|
|
|
+ $('#'+$props.parentModal).on('show.bs.modal', function () {
|
|
|
+ vc.component._initFloorSelect2();
|
|
|
+ })
|
|
|
},
|
|
|
methods: {
|
|
|
_initFloorSelect2: function () {
|
|
|
@@ -24,7 +27,7 @@
|
|
|
$('.floorSelector').select2({
|
|
|
placeholder: '必填,请选择楼栋',
|
|
|
ajax: {
|
|
|
- url: "/floorSelect2/list",
|
|
|
+ url: "/callComponent/floorSelect2/list",
|
|
|
dataType: 'json',
|
|
|
delay: 250,
|
|
|
data: function (params) {
|
|
|
@@ -41,17 +44,19 @@
|
|
|
};
|
|
|
},
|
|
|
cache: true
|
|
|
- },
|
|
|
- minimumInputLength: 2
|
|
|
+ }
|
|
|
});
|
|
|
$('.floorSelector').on("select2:select", function (evt) {
|
|
|
//这里是选中触发的事件
|
|
|
//evt.params.data 是选中项的信息
|
|
|
+ console.log('select',evt)
|
|
|
});
|
|
|
|
|
|
$('.floorSelector').on("select2:unselect", function (evt) {
|
|
|
//这里是取消选中触发的事件
|
|
|
//如配置allowClear: true后,触发
|
|
|
+ console.log('unselect',evt)
|
|
|
+
|
|
|
});
|
|
|
}
|
|
|
}
|