aos-element
Version:
A Component Library for Vue.js.
1,088 lines (992 loc) • 30.3 kB
JavaScript
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 106);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.
function normalizeComponent (
scriptExports,
render,
staticRenderFns,
functionalTemplate,
injectStyles,
scopeId,
moduleIdentifier, /* server only */
shadowMode /* vue-cli only */
) {
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (render) {
options.render = render
options.staticRenderFns = staticRenderFns
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// scopedId
if (scopeId) {
options._scopeId = 'data-v-' + scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = shadowMode
? function () {
injectStyles.call(
this,
(options.functional ? this.parent : this).$root.$options.shadowRoot
)
}
: injectStyles
}
if (hook) {
if (options.functional) {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// register for functional component in vue file
var originalRender = options.render
options.render = function renderWithStyleInjection (h, context) {
hook.call(context)
return originalRender(h, context)
}
} else {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
}
return {
exports: scriptExports,
options: options
}
}
/***/ }),
/***/ 106:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/aos-audio/src/main.vue?vue&type=template&id=0a0832ae&
var render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"div",
{ staticClass: "aos-audio-better", style: { width: _vm.totalWidth } },
[
_c("div", { staticClass: "aos-audio-better__operate" }, [
_c("i", {
class: {
"el-icon-playcircle-fill": !_vm.playing,
"el-icon-pausecircle-fill": _vm.playing
},
on: { click: _vm.togglePlayback }
}),
_c("i", {
staticClass: "el-icon-stopcircle-fill",
on: { click: _vm.stop }
}),
_c("span", { staticClass: "aos-audio-better__operate-time" }, [
_c("span", { staticClass: "aos-audio-better__operate-time-going" }, [
_vm._v(_vm._s(_vm._sToMs(_vm.seek)) + " ")
]),
_c("span", [_vm._v("/")]),
_c("span", { staticClass: "aos-audio-better__operate-time-total" }, [
_vm._v(_vm._s(_vm._sToMs(_vm.duration)))
])
])
]),
_c(
"div",
{
ref: "slider",
staticClass: "aos-audio-better__slider",
on: { click: _vm.handleModifyProgress }
},
[
_c("div", { staticClass: "aos-audio-better__slider-progressInfo" }),
_c("div", {
staticClass: "aos-audio-better__slider-process",
style: { width: _vm.pWidth }
}),
_c(
"div",
{
ref: "trunk",
staticClass: "aos-audio-better__slider-thunk",
style: { left: _vm.left }
},
[_c("div", { staticClass: "aos-audio-better__slider-block" })]
)
]
),
_vm.isMute
? _c("i", {
staticClass: "el-icon-notificationfill aos-audio-better__volume",
on: { click: _vm.handleToggleMute }
})
: _vm._e(),
!_vm.isMute
? _c("i", {
staticClass: "el-icon-notificationforbidfill",
on: { click: _vm.handleToggleMute }
})
: _vm._e(),
_c(
"div",
{
ref: "volumeSlider",
staticClass: "aos-audio-better__volume-slider",
on: { click: _vm.handleVolumeProgress }
},
[
_c("div", {
staticClass: "aos-audio-better__volume-slider-progressInfo"
}),
_c("div", {
staticClass: "aos-audio-better__volume-slider-process",
style: { width: _vm.volumeWidth }
}),
_c(
"div",
{
ref: "volumeTrunk",
staticClass: "aos-audio-better__volume-slider-thunk",
style: { left: _vm.volumeLeft }
},
[
_c("div", {
staticClass: "aos-audio-better__volume-slider-block"
})
]
)
]
),
_c(
"span",
{ staticClass: "aos-audio-better__rate" },
[
_c(
"el-dropdown",
{ attrs: { trigger: "click" }, on: { command: _vm.handleCommand } },
[
_c("span", { staticClass: "aos-audio-better__rate-trigger" }, [
_vm._v(
_vm._s(_vm.currentRate == 1 ? "倍速" : _vm.currentRate + "x")
)
]),
_c(
"el-dropdown-menu",
{ attrs: { slot: "dropdown" }, slot: "dropdown" },
[
_c("el-dropdown-item", { attrs: { command: 0.5 } }, [
_vm._v("0.5x")
]),
_c("el-dropdown-item", { attrs: { command: 1 } }, [
_vm._v("1x")
]),
_c("el-dropdown-item", { attrs: { command: 1.5 } }, [
_vm._v("1.5x")
]),
_c("el-dropdown-item", { attrs: { command: 2 } }, [
_vm._v("2x")
]),
_c("el-dropdown-item", { attrs: { command: 3 } }, [
_vm._v("3x")
]),
_c("el-dropdown-item", { attrs: { command: 4 } }, [
_vm._v("4x")
])
],
1
)
],
1
)
],
1
)
]
)
}
var staticRenderFns = []
render._withStripped = true
// CONCATENATED MODULE: ./packages/aos-audio/src/main.vue?vue&type=template&id=0a0832ae&
// EXTERNAL MODULE: external "howler"
var external_howler_ = __webpack_require__(72);
// EXTERNAL MODULE: external "math-clamp"
var external_math_clamp_ = __webpack_require__(55);
var external_math_clamp_default = /*#__PURE__*/__webpack_require__.n(external_math_clamp_);
// EXTERNAL MODULE: external "object-values"
var external_object_values_ = __webpack_require__(73);
var external_object_values_default = /*#__PURE__*/__webpack_require__.n(external_object_values_);
// EXTERNAL MODULE: external "object-assign"
var external_object_assign_ = __webpack_require__(65);
var external_object_assign_default = /*#__PURE__*/__webpack_require__.n(external_object_assign_);
// CONCATENATED MODULE: ./packages/aos-audio/src/audio.js
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
/* harmony default export */ var audio = ({
props: {
/**
* A string type url of audio file
*/
source: {
type: String,
required: true,
validator: function validator(source) {
// Every source must be a non-empty string
return typeof source === 'string' && source.length > 0;
}
},
/**
* Whether to start the playback
* when the component is mounted
*/
autoplay: {
type: Boolean,
default: false
},
/**
* Whether to start the playback again
* automatically after it is done playing
*/
loop: {
type: Boolean,
default: false
},
/**
* Whether to start downloading the audio
* file when the component is mounted
*/
preload: {
type: Boolean,
default: true
},
/**
* Whether to force HTML5 Audio
*/
html5: {
type: Boolean,
default: false
},
/**
* An array of audio file types
*/
formats: {
type: Array,
default: function _default() {
return ['mp3'];
}
},
/**
* Whether to enable the withCredentials flag on XHR
* requests used to fetch audio files when using Web Audio API
*/
xhrWithCredentials: {
type: Boolean,
default: false
}
},
data: function data() {
var _this = this;
return {
/**
* The Howl instance used for playback
*/
_howl: null,
/**
* Whether audio is currently playing
*/
playing: false,
/**
* Whether the audio playback is muted
*/
muted: false,
/**
* The volume of the playback on a scale of 0 to 1
*/
volume: 1.0,
/**
* The rate (speed) of the playback on a scale of 0.5 to 4
*/
rate: 1.0,
/**
* The position of playback in seconds
*/
seek: 0,
/**
* The duration of the audio in seconds
*/
duration: 0,
/**
* Functions that poll the Howl instance
* to update various data
*/
_polls: {
seek: {
id: null,
interval: 1000 / 4, // 4 times per second (4Hz)
hook: function hook() {
_this.seek = _this.$data._howl.seek();
}
}
},
/**
* A list of howl events to listen to and
* functions to call when they are triggered
*/
_howlEvents: [{
name: 'load',
hook: function hook() {
_this.duration = _this.$data._howl.duration();
}
}, 'loaderror', 'playerror', {
name: 'play',
hook: function hook() {
_this.playing = true;
}
}, {
name: 'end',
hook: function hook() {
_this.playing = false;
}
}, {
name: 'pause',
hook: function hook() {
_this.playing = false;
}
}, {
name: 'stop',
hook: function hook() {
_this.playing = false;
if (_this.$data._howl != null) {
_this.seek = _this.$data._howl.seek();
}
}
}, 'mute', {
name: 'volume',
hook: function hook() {
_this.volume = _this.$data._howl.volume();
}
}, {
name: 'rate',
hook: function hook() {
_this.rate = _this.$data._howl.rate();
}
}, {
name: 'seek',
hook: function hook() {
if (!_this.playing) _this.seek = _this.$data._howl.seek();
}
}, 'fade']
};
},
computed: {
/**
* The progress of the playback on a scale of 0 to 1
*/
progress: function progress() {
if (this.duration === 0) return 0;
return this.seek / this.duration;
}
},
created: function created() {
this._initialize();
},
beforeDestroy: function beforeDestroy() {
this._cleanup();
},
watch: {
playing: function playing(_playing) {
// Update the seek
this.seek = this.$data._howl.seek();
if (_playing) {
// Start the seek poll
this.$data._polls.seek.id = setInterval(this.$data._polls.seek.hook, this.$data._polls.seek.interval);
} else {
// Stop the seek poll
clearInterval(this.$data._polls.seek.id);
}
},
source: function source(_source) {
if (_source) {
this._reinitialize();
}
}
},
methods: {
/**
* Reinitialize the Howler player
*/
_reinitialize: function _reinitialize() {
this._cleanup(false);
this._initialize();
},
/**
* Initialize the Howler player
*/
_initialize: function _initialize() {
var _this2 = this;
if (!this.source) return;
this.$data._howl = new external_howler_["Howl"]({
src: this.source,
volume: this.volume,
html5: this.html5,
loop: this.loop,
preload: this.preload,
autoplay: this.autoplay,
mute: this.muted,
rate: this.rate,
format: this.formats,
xhrWithCredentials: this.xhrWithCredentials
});
this.setVolume(this.curVolume);
var duration = this.$data._howl.duration();
this.duration = duration;
if (duration > 0) {
// The audio file(s) have been cached. Howler won't
// emit a load event, so we will do this manually
this.$emit('load');
}
// Bind to all Howl events
this.$data._howlEvents = this.$data._howlEvents.map(function (event) {
// Normalize string shorthands to objects
if (typeof event === 'string') {
event = { name: event };
}
// Create a handler
var handler = function handler(id, details) {
if (typeof event.hook === 'function') event.hook(id, details);
_this2.$emit(event.name, id, details);
};
// Bind the handler
_this2.$data._howl.on(event.name, handler);
// Return the name and handler to unbind later
return external_object_assign_default()({}, event, { handler: handler });
});
},
/**
* Clean up the Howler player
*/
_cleanup: function _cleanup() {
var _this3 = this;
var resetSettings = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
// Stop all playback
if (this.$data._howl) {
this.stop();
}
// Stop all polls
external_object_values_default()(this.$data._polls).forEach(function (poll) {
if (poll.id != null) clearInterval(poll.id);
});
// Clear all event listeners
this.$data._howlEvents.map(function (event) {
if (event.handler) {
if (_this3.$data._howl) {
_this3.$data._howl.off(event.name, event.handler);
}
var _event = external_object_assign_default()({}, event);
delete _event.handler;
return _event;
}
return event;
});
// Destroy the Howl instance
this.$data._howl = null;
this.duration = 0;
if (resetSettings) {
this.muted = false;
this.volume = 1.0;
this.rate = 1.0;
}
},
/**
* Start the playback
*/
play: function play() {
if (!this.playing) this.$data._howl.play();
},
/**
* Pause the playback
*/
pause: function pause() {
if (this.playing) this.$data._howl.pause();
},
/**
* Toggle playing or pausing the playback
*/
togglePlayback: function togglePlayback() {
if (!this.playing) {
this.$data._howl.play();
} else {
this.$data._howl.pause();
}
},
/**
* Stop the playback (also resets the seek to 0)
*/
stop: function stop() {
this.$data._howl.stop();
},
/**
* Mute the playback
*/
mute: function mute() {
this.$data._howl.mute(true);
this.muted = true;
},
/**
* Unmute the playback
*/
unmute: function unmute() {
this.$data._howl.mute(false);
this.muted = false;
},
/**
* Toggle muting and unmuting the playback
*/
toggleMute: function toggleMute() {
this.$data._howl.mute(!this.muted);
this.muted = !this.muted;
},
/**
* Set the volume of the playback
* @param {Number} volume - The new volume.
* The value is clamped between 0 and 1
*/
isInstanceExist: function isInstanceExist() {
if (this.$data && this.$data._howl) {
return true;
}
return false;
},
setVolume: function setVolume(volume) {
if (typeof volume !== 'number') {
throw new Error('volume must be a number, got a ' + (typeof volume === 'undefined' ? 'undefined' : _typeof(volume)) + ' instead');
}
if (!this.isInstanceExist()) return;
this.$data._howl.volume(external_math_clamp_default()(volume, 0, 1));
this.volume = external_math_clamp_default()(volume, 0, 1);
},
/**
* Set the rate (speed) of the playback
* @param {Number} rate - The new rate.
* The value is clamped between 0.5 and 4
*/
setRate: function setRate(rate) {
if (typeof rate !== 'number') {
throw new Error('rate must be a number, got a ' + (typeof rate === 'undefined' ? 'undefined' : _typeof(rate)) + ' instead');
}
if (!this.isInstanceExist()) return;
this.$data._howl.rate(external_math_clamp_default()(rate, 0.5, 4));
},
/**
* Set the position of the playback
* @param {Number} seek - The new position in seconds.
* The value is clamped between 0 and the duration
*/
setSeek: function setSeek(seek) {
if (typeof seek !== 'number') {
throw new Error('seek must be a number, got a ' + (typeof seek === 'undefined' ? 'undefined' : _typeof(seek)) + ' instead');
}
if (!this.isInstanceExist()) return;
this.$data._howl.seek(external_math_clamp_default()(seek, 0, this.duration));
},
/**
* Set the progress of the playback
* @param {Number} progress - The new progress.
* The value is clamped between 0 and 1
*/
setProgress: function setProgress(progress) {
if (typeof progress !== 'number') {
throw new Error('progress must be a number, got a ' + (typeof progress === 'undefined' ? 'undefined' : _typeof(progress)) + ' instead');
}
this.setSeek(external_math_clamp_default()(progress, 0, 1) * this.duration);
}
}
});
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/aos-audio/src/main.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ var mainvue_type_script_lang_js_ = ({
name: 'AosAudio',
mixins: [audio],
props: ['width'],
data: function data() {
return {
min: 0,
max: 100,
slider: null,
thunk: null,
per: 0,
rate: 1,
volumeMin: 0,
volumeMax: 100,
volumeSlider: null,
volumeThunk: null,
volumePer: 1,
isMute: true,
curVolume: 0.5,
totalWidth: 500,
currentRate: '1'
};
},
watch: {
curProgress: function curProgress(v) {
// 避免拖拽未完成 进度发生变化
if (!document.onmouseup) {
this.per = v;
}
},
curVolumeProgress: function curVolumeProgress(v) {
// 避免拖拽未完成 进度发生变化
if (!document.onmouseup) {
this.volumePer = v;
}
}
},
computed: {
curProgress: function curProgress() {
var curProgress = (Math.round(this.progress * 10000) / 100.0).toFixed(2);
return curProgress;
},
curVolumeProgress: function curVolumeProgress() {
var curVolumeProgress = (Math.round(this.volume * 10000) / 100.0).toFixed(2);
return curVolumeProgress;
},
// 设置一个百分比,提供计算slider进度width和trunk的left值
scale: function scale() {
var scale = (this.per - this.min) / (this.max - this.min);
return scale;
},
volumeScale: function volumeScale() {
var scale = (this.volumePer - this.volumeMin) / (this.volumeMax - this.volumeMin);
return scale;
},
pWidth: function pWidth() {
if (this.slider) {
return this.slider.offsetWidth * this.scale + 'px';
} else {
return 0 + 'px';
}
},
volumeWidth: function volumeWidth() {
if (this.volumeSlider) {
console.log('volumeWidth', this.volumeSlider.offsetWidth * this.volumeScale + 'px');
return this.volumeSlider.offsetWidth * this.volumeScale + 'px';
} else {
return 100 + 'px';
}
},
left: function left() {
if (this.slider) {
return this.slider.offsetWidth * this.scale - this.thunk.offsetWidth / 2 + 'px';
} else {
return 0 + 'px';
}
},
volumeLeft: function volumeLeft() {
if (this.volumeSlider) {
return this.volumeSlider.offsetWidth * this.volumeScale - this.volumeThunk.offsetWidth / 2 + 'px';
} else {
return 100 + 'px';
}
}
},
methods: {
handleCommand: function handleCommand(rate) {
this.currentRate = rate;
this.setRate(rate);
},
handleModifyProgress: function handleModifyProgress(e) {
if (e.target.className === 'aos-audio-better__slider' || e.target.className === 'aos-audio-better__slider-process') {
var scale = e.offsetX / this.slider.offsetWidth;
this.setProgress(scale);
}
},
handleVolumeProgress: function handleVolumeProgress(e) {
if (e.target.className === 'aos-audio-better__volume-slider' || e.target.className === 'aos-audio-better__volume-slider-process') {
var scale = e.offsetX / this.volumeSlider.offsetWidth;
this.setVolume(scale);
}
},
handleToggleMute: function handleToggleMute() {
this.isMute ? this.isMute = false : this.isMute = true;
this.toggleMute();
},
_sToMs: function _sToMs(s) {
if (typeof s !== 'number') return '00' + ':' + '00';
s = parseInt(s);
var h = void 0;
h = Math.floor(s / 60);
s = s % 60;
h += '';
s += '';
h = h.length == 1 ? '0' + h : h;
s = s.length == 1 ? '0' + s : s;
return h + ':' + s;
}
},
mounted: function mounted() {
var _this = this;
if (this.width && typeof this.width === 'number') {
this.totalWidth = this.width + 'px';
}
this.slider = this.$refs.slider;
this.thunk = this.$refs.trunk;
this.thunk.onmousedown = function (e) {
var pWidth = parseInt(_this.pWidth);
var disX = e.clientX;
document.onmousemove = function (e) {
// 拖拽的时候获取的新width
var newWidth = e.clientX - disX + pWidth;
// 拖拽的时候得到新的百分比
var scale = newWidth / _this.slider.offsetWidth;
_this.per = Math.ceil((_this.max - _this.min) * scale + _this.min);
_this.per = Math.max(_this.per, _this.min);
_this.per = Math.min(_this.per, _this.max);
};
document.onmouseup = function () {
document.onmousemove = document.onmouseup = null;
_this.setProgress(_this.scale);
};
return false;
};
this.volumeSlider = this.$refs.volumeSlider;
this.volumeThunk = this.$refs.volumeTrunk;
this.volumeThunk.onmousedown = function (e) {
var volumeWidth = parseInt(_this.volumeWidth);
var disX = e.clientX;
document.onmousemove = function (e) {
// 拖拽的时候获取的新width
var newWidth = e.clientX - disX + volumeWidth;
// 拖拽的时候得到新的百分比
var scale = newWidth / _this.volumeSlider.offsetWidth;
_this.volumePer = Math.ceil((_this.volumeMax - _this.volumeMin) * scale + _this.volumeMin);
_this.volumePer = Math.max(_this.volumePer, _this.volumeMin);
_this.volumePer = Math.min(_this.volumePer, _this.volumeMax);
};
document.onmouseup = function () {
document.onmousemove = document.onmouseup = null;
_this.setVolume(_this.volumeScale);
};
return false;
};
}
});
// CONCATENATED MODULE: ./packages/aos-audio/src/main.vue?vue&type=script&lang=js&
/* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(0);
// CONCATENATED MODULE: ./packages/aos-audio/src/main.vue
/* normalize component */
var component = Object(componentNormalizer["a" /* default */])(
src_mainvue_type_script_lang_js_,
render,
staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var api; }
component.options.__file = "packages/aos-audio/src/main.vue"
/* harmony default export */ var main = (component.exports);
// CONCATENATED MODULE: ./packages/aos-audio/index.js
main.install = function (Vue) {
Vue.component(main.name, main);
};
/* harmony default export */ var aos_audio = __webpack_exports__["default"] = (main);
/***/ }),
/***/ 55:
/***/ (function(module, exports) {
module.exports = require("math-clamp");
/***/ }),
/***/ 65:
/***/ (function(module, exports) {
module.exports = require("object-assign");
/***/ }),
/***/ 72:
/***/ (function(module, exports) {
module.exports = require("howler");
/***/ }),
/***/ 73:
/***/ (function(module, exports) {
module.exports = require("object-values");
/***/ })
/******/ });