@weitutech/by-components 1.1.103 → 1.1.104

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.
@@ -79022,8 +79022,8 @@ var ByCascaderPanel_component = normalizeComponent(
79022
79022
  )
79023
79023
 
79024
79024
  /* harmony default export */ var ByCascaderPanel = (ByCascaderPanel_component.exports);
79025
- ;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"ffbc40de-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/floating-menu/ByFloatingMenu.vue?vue&type=template&id=7dd4a57b
79026
- var ByFloatingMenuvue_type_template_id_7dd4a57b_render = function render() {
79025
+ ;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"ffbc40de-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/floating-menu/ByFloatingMenu.vue?vue&type=template&id=365e7526
79026
+ var ByFloatingMenuvue_type_template_id_365e7526_render = function render() {
79027
79027
  var _vm = this,
79028
79028
  _c = _vm._self._c;
79029
79029
  return _c('div', {
@@ -79148,7 +79148,7 @@ var ByFloatingMenuvue_type_template_id_7dd4a57b_render = function render() {
79148
79148
  }, [_vm._v(_vm._s(item.text))])]);
79149
79149
  }), 0)])], 1);
79150
79150
  };
79151
- var ByFloatingMenuvue_type_template_id_7dd4a57b_staticRenderFns = [];
79151
+ var ByFloatingMenuvue_type_template_id_365e7526_staticRenderFns = [];
79152
79152
 
79153
79153
  ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/floating-menu/ByFloatingMenu.vue?vue&type=script&lang=js
79154
79154
  /* harmony default export */ var ByFloatingMenuvue_type_script_lang_js = ({
@@ -79185,6 +79185,14 @@ var ByFloatingMenuvue_type_template_id_7dd4a57b_staticRenderFns = [];
79185
79185
  }
79186
79186
  },
79187
79187
  data() {
79188
+ // 在 data 中初始化位置,避免渲染时的位置跳动
79189
+ const {
79190
+ right,
79191
+ bottom
79192
+ } = this.position;
79193
+ const windowHeight = typeof window !== 'undefined' ? window.innerHeight : 800;
79194
+ const bottomValue = parseInt(bottom) || 20;
79195
+ const mainButtonSize = this.getMainButtonSize();
79188
79196
  return {
79189
79197
  isExpanded: false,
79190
79198
  isHidden: false,
@@ -79196,9 +79204,12 @@ var ByFloatingMenuvue_type_template_id_7dd4a57b_staticRenderFns = [];
79196
79204
  },
79197
79205
  currentPosition: {
79198
79206
  x: 0,
79199
- y: 0
79207
+ y: windowHeight - bottomValue - mainButtonSize
79208
+ },
79209
+ menuStyle: {
79210
+ right: right,
79211
+ bottom: bottom
79200
79212
  },
79201
- menuStyle: {},
79202
79213
  // 菜单项拖动相关
79203
79214
  menuItemDragStart: {
79204
79215
  x: 0,
@@ -79211,43 +79222,53 @@ var ByFloatingMenuvue_type_template_id_7dd4a57b_staticRenderFns = [];
79211
79222
  computed: {
79212
79223
  // 根据size属性计算实际大小
79213
79224
  mainButtonSize() {
79214
- const sizeMap = {
79215
- mini: 40,
79216
- small: 50,
79217
- medium: 60
79218
- };
79219
- return sizeMap[this.size] || 50;
79225
+ return this.getMainButtonSize();
79220
79226
  }
79221
79227
  },
79222
79228
  mounted() {
79223
- this.initPosition();
79229
+ // 位置已在 data 中初始化,这里只需要重新计算以确保准确性
79230
+ this.refreshPosition();
79224
79231
  this.bindEvents();
79232
+ this.bindPageEvents();
79225
79233
  },
79226
79234
  beforeDestroy() {
79227
79235
  this.unbindEvents();
79236
+ this.unbindPageEvents();
79228
79237
  this.removeShowButton();
79229
79238
  // 清理菜单项拖动事件监听器
79230
79239
  document.removeEventListener('mousemove', this.onMenuItemDrag);
79231
79240
  document.removeEventListener('mouseup', this.endMenuItemDrag);
79232
79241
  },
79233
79242
  methods: {
79234
- // 初始化位置
79235
- initPosition() {
79243
+ // 获取主按钮大小的辅助方法
79244
+ getMainButtonSize() {
79245
+ const sizeMap = {
79246
+ mini: 40,
79247
+ small: 50,
79248
+ medium: 60
79249
+ };
79250
+ return sizeMap[this.size] || 50;
79251
+ },
79252
+ // 刷新位置(在 mounted 时重新计算以确保准确性)
79253
+ refreshPosition() {
79236
79254
  const {
79237
79255
  right,
79238
79256
  bottom
79239
79257
  } = this.position;
79258
+ const windowHeight = window.innerHeight;
79259
+ const bottomValue = parseInt(bottom) || 20;
79260
+
79261
+ // 更新菜单样式
79240
79262
  this.menuStyle = {
79263
+ ...this.menuStyle,
79241
79264
  right: right,
79242
79265
  bottom: bottom
79243
79266
  };
79244
79267
 
79245
- // 初始化当前位置
79246
- const windowHeight = window.innerHeight;
79247
- const bottomValue = parseInt(bottom) || 20;
79268
+ // 更新当前位置
79248
79269
  this.currentPosition = {
79249
79270
  x: 0,
79250
- y: windowHeight - bottomValue - this.mainButtonSize // 使用动态主按钮大小
79271
+ y: windowHeight - bottomValue - this.mainButtonSize
79251
79272
  };
79252
79273
  },
79253
79274
  // 切换菜单展开状态
@@ -79544,6 +79565,40 @@ var ByFloatingMenuvue_type_template_id_7dd4a57b_staticRenderFns = [];
79544
79565
  // 切换显示/隐藏状态
79545
79566
  toggle() {
79546
79567
  this.toggleHide();
79568
+ },
79569
+ // 绑定页面相关事件
79570
+ bindPageEvents() {
79571
+ // 监听页面可见性变化(切换 tab)
79572
+ document.addEventListener('visibilitychange', this.onVisibilityChange);
79573
+
79574
+ // 监听页面卸载事件
79575
+ window.addEventListener('beforeunload', this.onPageUnload);
79576
+
79577
+ // 监听路由变化(如果使用了 Vue Router)
79578
+ if (this.$router) {
79579
+ this.$router.beforeEach((to, from, next) => {
79580
+ // 在路由切换前移除显示按钮
79581
+ this.removeShowButton();
79582
+ next();
79583
+ });
79584
+ }
79585
+ },
79586
+ // 解绑页面相关事件
79587
+ unbindPageEvents() {
79588
+ document.removeEventListener('visibilitychange', this.onVisibilityChange);
79589
+ window.removeEventListener('beforeunload', this.onPageUnload);
79590
+ },
79591
+ // 页面可见性变化处理
79592
+ onVisibilityChange() {
79593
+ if (document.hidden) {
79594
+ // 页面变为隐藏状态(切换 tab 或最小化),移除显示按钮
79595
+ this.removeShowButton();
79596
+ }
79597
+ },
79598
+ // 页面卸载处理
79599
+ onPageUnload() {
79600
+ // 页面卸载前移除显示按钮
79601
+ this.removeShowButton();
79547
79602
  }
79548
79603
  }
79549
79604
  });
@@ -79559,8 +79614,8 @@ var ByFloatingMenuvue_type_template_id_7dd4a57b_staticRenderFns = [];
79559
79614
  ;
79560
79615
  var ByFloatingMenu_component = normalizeComponent(
79561
79616
  floating_menu_ByFloatingMenuvue_type_script_lang_js,
79562
- ByFloatingMenuvue_type_template_id_7dd4a57b_render,
79563
- ByFloatingMenuvue_type_template_id_7dd4a57b_staticRenderFns,
79617
+ ByFloatingMenuvue_type_template_id_365e7526_render,
79618
+ ByFloatingMenuvue_type_template_id_365e7526_staticRenderFns,
79564
79619
  false,
79565
79620
  null,
79566
79621
  null,
@@ -79032,8 +79032,8 @@ var ByCascaderPanel_component = normalizeComponent(
79032
79032
  )
79033
79033
 
79034
79034
  /* harmony default export */ var ByCascaderPanel = (ByCascaderPanel_component.exports);
79035
- ;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"ffbc40de-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/floating-menu/ByFloatingMenu.vue?vue&type=template&id=7dd4a57b
79036
- var ByFloatingMenuvue_type_template_id_7dd4a57b_render = function render() {
79035
+ ;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"ffbc40de-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/floating-menu/ByFloatingMenu.vue?vue&type=template&id=365e7526
79036
+ var ByFloatingMenuvue_type_template_id_365e7526_render = function render() {
79037
79037
  var _vm = this,
79038
79038
  _c = _vm._self._c;
79039
79039
  return _c('div', {
@@ -79158,7 +79158,7 @@ var ByFloatingMenuvue_type_template_id_7dd4a57b_render = function render() {
79158
79158
  }, [_vm._v(_vm._s(item.text))])]);
79159
79159
  }), 0)])], 1);
79160
79160
  };
79161
- var ByFloatingMenuvue_type_template_id_7dd4a57b_staticRenderFns = [];
79161
+ var ByFloatingMenuvue_type_template_id_365e7526_staticRenderFns = [];
79162
79162
 
79163
79163
  ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/floating-menu/ByFloatingMenu.vue?vue&type=script&lang=js
79164
79164
  /* harmony default export */ var ByFloatingMenuvue_type_script_lang_js = ({
@@ -79195,6 +79195,14 @@ var ByFloatingMenuvue_type_template_id_7dd4a57b_staticRenderFns = [];
79195
79195
  }
79196
79196
  },
79197
79197
  data() {
79198
+ // 在 data 中初始化位置,避免渲染时的位置跳动
79199
+ const {
79200
+ right,
79201
+ bottom
79202
+ } = this.position;
79203
+ const windowHeight = typeof window !== 'undefined' ? window.innerHeight : 800;
79204
+ const bottomValue = parseInt(bottom) || 20;
79205
+ const mainButtonSize = this.getMainButtonSize();
79198
79206
  return {
79199
79207
  isExpanded: false,
79200
79208
  isHidden: false,
@@ -79206,9 +79214,12 @@ var ByFloatingMenuvue_type_template_id_7dd4a57b_staticRenderFns = [];
79206
79214
  },
79207
79215
  currentPosition: {
79208
79216
  x: 0,
79209
- y: 0
79217
+ y: windowHeight - bottomValue - mainButtonSize
79218
+ },
79219
+ menuStyle: {
79220
+ right: right,
79221
+ bottom: bottom
79210
79222
  },
79211
- menuStyle: {},
79212
79223
  // 菜单项拖动相关
79213
79224
  menuItemDragStart: {
79214
79225
  x: 0,
@@ -79221,43 +79232,53 @@ var ByFloatingMenuvue_type_template_id_7dd4a57b_staticRenderFns = [];
79221
79232
  computed: {
79222
79233
  // 根据size属性计算实际大小
79223
79234
  mainButtonSize() {
79224
- const sizeMap = {
79225
- mini: 40,
79226
- small: 50,
79227
- medium: 60
79228
- };
79229
- return sizeMap[this.size] || 50;
79235
+ return this.getMainButtonSize();
79230
79236
  }
79231
79237
  },
79232
79238
  mounted() {
79233
- this.initPosition();
79239
+ // 位置已在 data 中初始化,这里只需要重新计算以确保准确性
79240
+ this.refreshPosition();
79234
79241
  this.bindEvents();
79242
+ this.bindPageEvents();
79235
79243
  },
79236
79244
  beforeDestroy() {
79237
79245
  this.unbindEvents();
79246
+ this.unbindPageEvents();
79238
79247
  this.removeShowButton();
79239
79248
  // 清理菜单项拖动事件监听器
79240
79249
  document.removeEventListener('mousemove', this.onMenuItemDrag);
79241
79250
  document.removeEventListener('mouseup', this.endMenuItemDrag);
79242
79251
  },
79243
79252
  methods: {
79244
- // 初始化位置
79245
- initPosition() {
79253
+ // 获取主按钮大小的辅助方法
79254
+ getMainButtonSize() {
79255
+ const sizeMap = {
79256
+ mini: 40,
79257
+ small: 50,
79258
+ medium: 60
79259
+ };
79260
+ return sizeMap[this.size] || 50;
79261
+ },
79262
+ // 刷新位置(在 mounted 时重新计算以确保准确性)
79263
+ refreshPosition() {
79246
79264
  const {
79247
79265
  right,
79248
79266
  bottom
79249
79267
  } = this.position;
79268
+ const windowHeight = window.innerHeight;
79269
+ const bottomValue = parseInt(bottom) || 20;
79270
+
79271
+ // 更新菜单样式
79250
79272
  this.menuStyle = {
79273
+ ...this.menuStyle,
79251
79274
  right: right,
79252
79275
  bottom: bottom
79253
79276
  };
79254
79277
 
79255
- // 初始化当前位置
79256
- const windowHeight = window.innerHeight;
79257
- const bottomValue = parseInt(bottom) || 20;
79278
+ // 更新当前位置
79258
79279
  this.currentPosition = {
79259
79280
  x: 0,
79260
- y: windowHeight - bottomValue - this.mainButtonSize // 使用动态主按钮大小
79281
+ y: windowHeight - bottomValue - this.mainButtonSize
79261
79282
  };
79262
79283
  },
79263
79284
  // 切换菜单展开状态
@@ -79554,6 +79575,40 @@ var ByFloatingMenuvue_type_template_id_7dd4a57b_staticRenderFns = [];
79554
79575
  // 切换显示/隐藏状态
79555
79576
  toggle() {
79556
79577
  this.toggleHide();
79578
+ },
79579
+ // 绑定页面相关事件
79580
+ bindPageEvents() {
79581
+ // 监听页面可见性变化(切换 tab)
79582
+ document.addEventListener('visibilitychange', this.onVisibilityChange);
79583
+
79584
+ // 监听页面卸载事件
79585
+ window.addEventListener('beforeunload', this.onPageUnload);
79586
+
79587
+ // 监听路由变化(如果使用了 Vue Router)
79588
+ if (this.$router) {
79589
+ this.$router.beforeEach((to, from, next) => {
79590
+ // 在路由切换前移除显示按钮
79591
+ this.removeShowButton();
79592
+ next();
79593
+ });
79594
+ }
79595
+ },
79596
+ // 解绑页面相关事件
79597
+ unbindPageEvents() {
79598
+ document.removeEventListener('visibilitychange', this.onVisibilityChange);
79599
+ window.removeEventListener('beforeunload', this.onPageUnload);
79600
+ },
79601
+ // 页面可见性变化处理
79602
+ onVisibilityChange() {
79603
+ if (document.hidden) {
79604
+ // 页面变为隐藏状态(切换 tab 或最小化),移除显示按钮
79605
+ this.removeShowButton();
79606
+ }
79607
+ },
79608
+ // 页面卸载处理
79609
+ onPageUnload() {
79610
+ // 页面卸载前移除显示按钮
79611
+ this.removeShowButton();
79557
79612
  }
79558
79613
  }
79559
79614
  });
@@ -79569,8 +79624,8 @@ var ByFloatingMenuvue_type_template_id_7dd4a57b_staticRenderFns = [];
79569
79624
  ;
79570
79625
  var ByFloatingMenu_component = normalizeComponent(
79571
79626
  floating_menu_ByFloatingMenuvue_type_script_lang_js,
79572
- ByFloatingMenuvue_type_template_id_7dd4a57b_render,
79573
- ByFloatingMenuvue_type_template_id_7dd4a57b_staticRenderFns,
79627
+ ByFloatingMenuvue_type_template_id_365e7526_render,
79628
+ ByFloatingMenuvue_type_template_id_365e7526_staticRenderFns,
79574
79629
  false,
79575
79630
  null,
79576
79631
  null,