Skip to content
This repository has been archived by the owner on Jun 6, 2020. It is now read-only.

Commit

Permalink
support window.VueDPlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
sinchang committed Jan 31, 2018
1 parent 942823c commit c9712cf
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 9 deletions.
8 changes: 6 additions & 2 deletions dist/vue-dplayer.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau

var DPlayer = _interopDefault(require('dplayer'));

var index = {
var VueDPlayer = {
props: {
options: {
type: Object
Expand Down Expand Up @@ -49,4 +49,8 @@ var index = {
}
};

module.exports = index;
if (typeof window !== 'undefined' && window.Vue) {
window.VueDPlayer = VueDPlayer;
}

module.exports = VueDPlayer;
8 changes: 6 additions & 2 deletions dist/vue-dplayer.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import DPlayer from 'dplayer';

var index = {
var VueDPlayer = {
props: {
options: {
type: Object
Expand Down Expand Up @@ -45,4 +45,8 @@ var index = {
}
};

export default index;
if (typeof window !== 'undefined' && window.Vue) {
window.VueDPlayer = VueDPlayer;
}

export default VueDPlayer;
8 changes: 6 additions & 2 deletions dist/vue-dplayer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/vue-dplayer.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vue-dplayer.min.js.map

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions example/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Demo</title>
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<script src="../dist/vue-dplayer.js"></script>
<link rel="stylesheet" href="../dist/vue-dplayer.css">
</head>

<body>
<div id="app">
<d-player :options="options"></d-player>
</div>
<script>
new Vue({
el: '#app',
components: {
'd-player': VueDPlayer
},
data: {
options: {
video: {
url: 'http://static.smartisanos.cn/common/video/t1-ui.mp4',
pic: 'http://static.smartisanos.cn/pr/img/video/video_03_cc87ce5bdb.jpg'
},
autoplay: false,
contextmenu: [{
text: 'GitHub',
link: 'https://github.com/MoePlayer/vue-dplayer'
}]
},
}
})

</script>
</body>

</html>

8 changes: 7 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DPlayer from 'dplayer'
import '../node_modules/dplayer/dist/DPlayer.min.css'

export default {
const VueDPlayer = {
props: {
options: {
type: Object
Expand Down Expand Up @@ -35,3 +35,9 @@ export default {
}, [])
}
}

if (typeof window !== 'undefined' && window.Vue) {
window.VueDPlayer = VueDPlayer
}

export default VueDPlayer

0 comments on commit c9712cf

Please sign in to comment.