vue-lazy-cascader 0.1.11 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -29,8 +29,10 @@ pnpm install vue-lazy-cascader --save
29
29
 
30
30
  ## 使用方法
31
31
 
32
- ```javascript
33
- import VueLazyCascader from "vue-lazy-cascader";
34
- ```
32
+ - [es模块示例](./src/components/VueLazyCascaderExample.vue)
33
+
34
+ ```javascript
35
+ import VueLazyCascader from "vue-lazy-cascader";
36
+ ```
35
37
 
36
- [es模块示例](./src/components/VueLazyCascaderExample.vue)
38
+ - [直接script引入示例](./example/index.html)
@@ -1606,7 +1606,7 @@ if (typeof window !== 'undefined') {
1606
1606
  // Indicate to webpack that this file can be concatenated
1607
1607
  /* harmony default export */ var setPublicPath = (null);
1608
1608
 
1609
- ;// CONCATENATED MODULE: ./node_modules/.pnpm/vue-loader@15.11.1_css-loader@6.11.0_vue-template-compiler@2.6.14_webpack@5.91.0/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/.pnpm/vue-loader@15.11.1_css-loader@6.11.0_vue-template-compiler@2.6.14_webpack@5.91.0/node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/cascader/src/cascader.vue?vue&type=template&id=34a69b59
1609
+ ;// CONCATENATED MODULE: ./node_modules/.pnpm/vue-loader@15.11.1_css-loader@6.11.0_vue-template-compiler@2.6.14_webpack@5.91.0/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/.pnpm/vue-loader@15.11.1_css-loader@6.11.0_vue-template-compiler@2.6.14_webpack@5.91.0/node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/cascader/src/cascader.vue?vue&type=template&id=65be7ea0
1610
1610
  var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"clickoutside",rawName:"v-clickoutside",value:(function () { return _vm.toggleDropDownVisible(false); }),expression:"() => toggleDropDownVisible(false)"}],ref:"reference",class:[
1611
1611
  'el-cascader',
1612
1612
  _vm.realSize && ("el-cascader--" + _vm.realSize),
@@ -5473,7 +5473,6 @@ const stopPropagation = e => e.stopPropagation();
5473
5473
  panel.handleExpand(node);
5474
5474
  },
5475
5475
  handleMultiCheckChange(checked) {
5476
- console.log(checked, 'checked---');
5477
5476
  this.node.doCheck(checked);
5478
5477
  this.panel.calculateMultiCheckedValue();
5479
5478
  },
@@ -5797,11 +5796,18 @@ var cascader_node_component = normalizeComponent(
5797
5796
  if (poor == parseInt(wrap.scrollTop) || poor == Math.ceil(wrap.scrollTop) || poor == Math.floor(wrap.scrollTop)) {
5798
5797
  let parentNode = this.nodes[0] && this.nodes[0].parent;
5799
5798
  const resolve = data => {
5799
+ if (isEmpty(data)) return; // 必须return,否则可能会死循环
5800
5800
  // append当前父节点中不存在的节点到
5801
- data.forEach(d => {
5802
- const loadedVals = parentNode.children.map(n => n.getValue());
5803
- const index = loadedVals.findIndex(v => v === d[this.panel.config.value]);
5804
- index == -1 && this.panel.store.appendNode(d, parentNode);
5801
+ const loadedVals = parentNode.children.map(n => n.getValue());
5802
+ const toAppendData = data.filter(d => !loadedVals.includes(d[this.panel.config.value]));
5803
+ if (toAppendData.length == 0) {
5804
+ this.$nextTick(() => {
5805
+ this.$emit('menu-scroll-bottom', parentNode, resolve);
5806
+ });
5807
+ return;
5808
+ }
5809
+ toAppendData.forEach(d => {
5810
+ this.panel.store.appendNode(d, parentNode);
5805
5811
  });
5806
5812
  // 同步checkedValue到节点checked
5807
5813
  this.panel.syncMultiCheckState();
@@ -7377,7 +7383,7 @@ const InputSizeMap = {
7377
7383
  const loadedFlattedNodesVals = this.panel.getFlattedNodes(false).map(n => n.value);
7378
7384
 
7379
7385
  // 2.从data中过滤掉出没加载的数据, 并append到store
7380
- const toAppendData = data.filter(node => !loadedFlattedNodesVals.includes(node.value));
7386
+ const toAppendData = data.filter(d => !loadedFlattedNodesVals.includes(d[this.panel.config.value]));
7381
7387
  // 2.1 如果没有待append的数据,说明用户给的data都是已经加载过的,那么emit触底事件
7382
7388
  if (toAppendData.length == 0) {
7383
7389
  this.$nextTick(() => {
@@ -7391,7 +7397,7 @@ const InputSizeMap = {
7391
7397
  parentNode && this.panel.store.appendNode(d, parentNode);
7392
7398
  });
7393
7399
  // 3.根据checkedValue同步多选状态(用户一开始就传入了选中的value)
7394
- this.panel.syncMultiCheckState();
7400
+ toAppendData.length && this.panel.syncMultiCheckState();
7395
7401
 
7396
7402
  // 3.调用前端搜索方法
7397
7403
  this.getSuggestions();