@94ai/nf-audio 3.3.72 → 3.3.74

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.
@@ -95,11 +95,11 @@ const _sfc_main = {
95
95
  },
96
96
  // 默认速度
97
97
  initSpeedValue: {
98
- type: Number,
98
+ type: Number | String,
99
99
  default: 1
100
100
  },
101
101
  initVolumnValue: {
102
- type: Number,
102
+ type: Number | String,
103
103
  default: 0.8
104
104
  },
105
105
  betweenStart: {
@@ -182,9 +182,9 @@ const _sfc_main = {
182
182
  }
183
183
  },
184
184
  mounted() {
185
- this.volume = this.initVolumnValue;
186
- this.volumeValue = this.initVolumnValue * 100;
187
- this.syncSpeed();
185
+ this.volume = Number(this.initVolumnValue);
186
+ this.volumeValue = this.volume * 100;
187
+ this.speed = Number(this.initSpeedValue);
188
188
  },
189
189
  beforeDestroy() {
190
190
  var _a, _b, _c, _d;
@@ -213,11 +213,6 @@ const _sfc_main = {
213
213
  this.betweenPlaying = false;
214
214
  this.jumpToTime(time);
215
215
  },
216
- syncSpeed() {
217
- if (this.speed != this.initSpeedValue) {
218
- this.speed = this.initSpeedValue;
219
- }
220
- },
221
216
  docClick(e) {
222
217
  if (this.$refs.popperRef.contains(e.target) || this.$refs.reference.contains(e.target)) {
223
218
  return;
@@ -478,10 +473,13 @@ const _sfc_main = {
478
473
  changeSpeed(speed) {
479
474
  if (!this.disabled) {
480
475
  if (this.audio) {
481
- this.audio.playbackRate = speed;
476
+ const preSpeed = this.speed;
477
+ this.speed = Number(speed);
478
+ if (this.speed !== preSpeed) {
479
+ this.audio.playbackRate = this.speed;
480
+ this.$emit("speedChange", this.speed);
481
+ }
482
482
  }
483
- this.speed = speed;
484
- this.$emit("speedChange", speed);
485
483
  }
486
484
  },
487
485
  downRecord(e) {
@@ -555,16 +553,14 @@ const _sfc_main = {
555
553
  },
556
554
  watch: {
557
555
  initSpeedValue: {
558
- handle() {
559
- if (this.speed != this.initSpeedValue) {
560
- this.speed = this.initSpeedValue;
561
- }
556
+ handler() {
557
+ this.speed = Number(this.initSpeedValue);
562
558
  }
563
559
  },
564
560
  initVolumnValue: {
565
- handle() {
566
- this.volume = this.initVolumnValue;
567
- this.volumeValue = this.initVolumnValue * 100;
561
+ handler() {
562
+ this.volume = Number(this.initVolumnValue);
563
+ this.volumeValue = this.volume * 100;
568
564
  }
569
565
  },
570
566
  volumeVisible(val) {
@@ -818,7 +814,7 @@ var _sfc_render = function render() {
818
814
  return _c("div", {
819
815
  key: index,
820
816
  staticClass: "nf-audio-btn-item",
821
- class: _vm.speed == item ? "active" : "",
817
+ class: _vm.speed == Number(item) ? "active" : "",
822
818
  on: {
823
819
  "click": function($event) {
824
820
  return _vm.changeSpeed(item);
@@ -93,11 +93,11 @@ const _sfc_main = {
93
93
  },
94
94
  // 默认速度
95
95
  initSpeedValue: {
96
- type: Number,
96
+ type: Number | String,
97
97
  default: 1
98
98
  },
99
99
  initVolumnValue: {
100
- type: Number,
100
+ type: Number | String,
101
101
  default: 0.8
102
102
  },
103
103
  betweenStart: {
@@ -180,9 +180,9 @@ const _sfc_main = {
180
180
  }
181
181
  },
182
182
  mounted() {
183
- this.volume = this.initVolumnValue;
184
- this.volumeValue = this.initVolumnValue * 100;
185
- this.syncSpeed();
183
+ this.volume = Number(this.initVolumnValue);
184
+ this.volumeValue = this.volume * 100;
185
+ this.speed = Number(this.initSpeedValue);
186
186
  },
187
187
  beforeDestroy() {
188
188
  var _a, _b, _c, _d;
@@ -211,11 +211,6 @@ const _sfc_main = {
211
211
  this.betweenPlaying = false;
212
212
  this.jumpToTime(time);
213
213
  },
214
- syncSpeed() {
215
- if (this.speed != this.initSpeedValue) {
216
- this.speed = this.initSpeedValue;
217
- }
218
- },
219
214
  docClick(e) {
220
215
  if (this.$refs.popperRef.contains(e.target) || this.$refs.reference.contains(e.target)) {
221
216
  return;
@@ -476,10 +471,13 @@ const _sfc_main = {
476
471
  changeSpeed(speed) {
477
472
  if (!this.disabled) {
478
473
  if (this.audio) {
479
- this.audio.playbackRate = speed;
474
+ const preSpeed = this.speed;
475
+ this.speed = Number(speed);
476
+ if (this.speed !== preSpeed) {
477
+ this.audio.playbackRate = this.speed;
478
+ this.$emit("speedChange", this.speed);
479
+ }
480
480
  }
481
- this.speed = speed;
482
- this.$emit("speedChange", speed);
483
481
  }
484
482
  },
485
483
  downRecord(e) {
@@ -553,16 +551,14 @@ const _sfc_main = {
553
551
  },
554
552
  watch: {
555
553
  initSpeedValue: {
556
- handle() {
557
- if (this.speed != this.initSpeedValue) {
558
- this.speed = this.initSpeedValue;
559
- }
554
+ handler() {
555
+ this.speed = Number(this.initSpeedValue);
560
556
  }
561
557
  },
562
558
  initVolumnValue: {
563
- handle() {
564
- this.volume = this.initVolumnValue;
565
- this.volumeValue = this.initVolumnValue * 100;
559
+ handler() {
560
+ this.volume = Number(this.initVolumnValue);
561
+ this.volumeValue = this.volume * 100;
566
562
  }
567
563
  },
568
564
  volumeVisible(val) {
@@ -816,7 +812,7 @@ var _sfc_render = function render() {
816
812
  return _c("div", {
817
813
  key: index,
818
814
  staticClass: "nf-audio-btn-item",
819
- class: _vm.speed == item ? "active" : "",
815
+ class: _vm.speed == Number(item) ? "active" : "",
820
816
  on: {
821
817
  "click": function($event) {
822
818
  return _vm.changeSpeed(item);
@@ -138,7 +138,7 @@
138
138
  <div v-for="(item,index) in multipleArray"
139
139
  :key="index"
140
140
  class="nf-audio-btn-item"
141
- :class="speed==item?'active':''"
141
+ :class="speed==Number(item)?'active':''"
142
142
  @click="changeSpeed(item)"
143
143
  >
144
144
  {{ speedPreDesc }}{{ item }}
@@ -255,11 +255,11 @@ export default {
255
255
  },
256
256
  // 默认速度
257
257
  initSpeedValue: {
258
- type: Number,
258
+ type: Number | String,
259
259
  default: 1.0
260
260
  },
261
261
  initVolumnValue: {
262
- type: Number,
262
+ type: Number | String,
263
263
  default: 0.8
264
264
  },
265
265
  betweenStart: {
@@ -346,9 +346,9 @@ export default {
346
346
  }
347
347
  },
348
348
  mounted() {
349
- this.volume = this.initVolumnValue
350
- this.volumeValue = this.initVolumnValue * 100
351
- this.syncSpeed()
349
+ this.volume = Number(this.initVolumnValue)
350
+ this.volumeValue = this.volume * 100
351
+ this.speed = Number(this.initSpeedValue)
352
352
  },
353
353
  beforeDestroy() {
354
354
  this.betweenPlaying = false
@@ -379,11 +379,6 @@ export default {
379
379
  this.betweenPlaying = false
380
380
  this.jumpToTime(time)
381
381
  },
382
- syncSpeed() {
383
- if (this.speed != this.initSpeedValue) {
384
- this.speed = this.initSpeedValue
385
- }
386
- },
387
382
  docClick(e) {
388
383
  //如果点击的是音量 或者 是音量面板 则 不隐藏音量面板
389
384
  if (this.$refs.popperRef.contains(e.target) || this.$refs.reference.contains(e.target)) {
@@ -652,10 +647,13 @@ export default {
652
647
  changeSpeed(speed) {
653
648
  if (!this.disabled) {
654
649
  if (this.audio) {
655
- this.audio.playbackRate = speed
650
+ const preSpeed = this.speed
651
+ this.speed = Number(speed)
652
+ if (this.speed !== preSpeed) {
653
+ this.audio.playbackRate = this.speed
654
+ this.$emit('speedChange', this.speed)
655
+ }
656
656
  }
657
- this.speed = speed
658
- this.$emit('speedChange', speed)
659
657
  }
660
658
  },
661
659
  downRecord(e) {
@@ -731,16 +729,14 @@ export default {
731
729
  },
732
730
  watch: {
733
731
  initSpeedValue: {
734
- handle() {
735
- if (this.speed != this.initSpeedValue) {
736
- this.speed = this.initSpeedValue
737
- }
732
+ handler() {
733
+ this.speed = Number(this.initSpeedValue)
738
734
  }
739
735
  },
740
736
  initVolumnValue: {
741
- handle() {
742
- this.volume = this.initVolumnValue
743
- this.volumeValue = this.initVolumnValue * 100
737
+ handler() {
738
+ this.volume = Number(this.initVolumnValue)
739
+ this.volumeValue = this.volume * 100
744
740
  }
745
741
  },
746
742
  volumeVisible(val) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-audio",
3
- "version": "3.3.72",
3
+ "version": "3.3.74",
4
4
  "description": "> TODO: description",
5
5
  "keywords": [],
6
6
  "author": "liuxiangxiang <liuxiangxiang@94ai.com>",
@@ -14,8 +14,8 @@
14
14
  "url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
15
15
  },
16
16
  "dependencies": {
17
- "@94ai/nf-message": "^3.3.72",
18
- "@94ai/nf-theme-chalk": "^3.3.72",
17
+ "@94ai/nf-message": "^3.3.74",
18
+ "@94ai/nf-theme-chalk": "^3.3.74",
19
19
  "vue-demi": "^0.14.5"
20
20
  },
21
21
  "peerDependenciesMeta": {
@@ -31,5 +31,5 @@
31
31
  "types": "lib/index.d.ts",
32
32
  "main": "lib/nf-audio.cjs.js",
33
33
  "module": "lib/nf-audio.esm-bundler.js",
34
- "gitHead": "4eebd978be0f247c218d57b0909f71e84a24734b"
34
+ "gitHead": "ded149b3495dc315b06db8f2d5cc471512043074"
35
35
  }