mirror of
https://github.com/langyuxiansheng/vue-aliplayer-v2.git
synced 2025-05-21 23:49:20 +08:00
优化部分代码
This commit is contained in:
parent
b2109016de
commit
21261846f1
@ -1,8 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<vue-aliplayer-v2 ref="VueAliplayerV2" id="player-1194076936807170050" :options="{source:'rtmp://182.145.195.238:1935/hls/1194076936807170050'}" />
|
<vue-aliplayer-v2 ref="VueAliplayerV2" id="player-1194076936807170050" :options="{source:'rtmp://182.145.195.238:1935/hls/1194076936807170053'}" />
|
||||||
<vue-aliplayer-v2 ref="VueAliplayerV2" id="player-1194076936807170051" :options="{source:'rtmp://182.145.195.238:1935/hls/1194076936807170051'}" />
|
<vue-aliplayer-v2 ref="VueAliplayerV2" id="player-1194076936807170051" :options="{source:'rtmp://182.145.195.238:1935/hls/1194076936807170051'}" />
|
||||||
<vue-aliplayer-v2 ref="VueAliplayerV2" id="player-1194076936807170052" :options="{source:'rtmp://182.145.195.238:1935/hls/1194076936807170052'}" />
|
|
||||||
<button @click="play()">播放</button>
|
<button @click="play()">播放</button>
|
||||||
<button @click="pause()">暂停</button>
|
<button @click="pause()">暂停</button>
|
||||||
<button @click="replay()">重播</button>
|
<button @click="replay()">重播</button>
|
||||||
@ -14,10 +13,6 @@ export default {
|
|||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
value: null,
|
value: null,
|
||||||
options:{
|
|
||||||
isSign: true, //签名模式 [Boolean] 默认为非签名模式,有线框, 当设置为true的时候没有任何线框
|
|
||||||
isShowBorder: false, //是否显示边框 [可选]
|
|
||||||
},
|
|
||||||
player: null
|
player: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// 导入组件,组件必须声明 name
|
// 导入组件,组件必须声明 name
|
||||||
import AliplayerV2 from './src/main.vue';
|
import VueAliplayerV2 from './src/main.vue';
|
||||||
// 为组件添加 install 方法,用于按需引入
|
// 为组件添加 install 方法,用于按需引入
|
||||||
AliplayerV2.install = function (Vue) {
|
VueAliplayerV2.install = function (Vue) {
|
||||||
Vue.component(AliplayerV2.name, AliplayerV2);
|
Vue.component(VueAliplayerV2.name, VueAliplayerV2);
|
||||||
}
|
}
|
||||||
export default AliplayerV2;
|
export default VueAliplayerV2;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
// packages / index.js
|
// packages / index.js
|
||||||
// 导入单个组件
|
// 导入单个组件
|
||||||
import AliplayerV2 from './AliplayerV2';
|
import VueAliplayerV2 from './AliplayerV2';
|
||||||
|
|
||||||
// 以数组的结构保存组件,便于遍历
|
// 以数组的结构保存组件,便于遍历
|
||||||
const components = [
|
const components = [
|
||||||
AliplayerV2
|
VueAliplayerV2
|
||||||
];
|
];
|
||||||
|
|
||||||
// 定义 install 方法
|
// 定义 install 方法
|
||||||
@ -13,18 +13,15 @@ const install = (Vue) =>{
|
|||||||
install.installed = true;
|
install.installed = true;
|
||||||
// 遍历并注册全局组件
|
// 遍历并注册全局组件
|
||||||
components.map(component => {
|
components.map(component => {
|
||||||
Vue.component(component.name, component)
|
return Vue.component(component.name, component)
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (typeof window !== 'undefined' && window.Vue) {
|
if (typeof window !== 'undefined' && window.Vue) {
|
||||||
install(window.Vue);
|
install(window.Vue);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
// 导出的对象必须具备一个 install 方法
|
// 导出的对象必须具备一个 install 方法
|
||||||
install,
|
install,
|
||||||
AliplayerV2,
|
VueAliplayerV2
|
||||||
// 组件列表
|
// 组件列表
|
||||||
...components
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user