Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
tswj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2022-05-22 11:22:41 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
be21d8e8cc62c5422b0d6b7eaa3ac24760bd7039
be21d8e8
1 parent
4995718b
优化测试
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
35 deletions
src/App.vue
src/components/VideoCard/index.vue
src/store/index.js
src/App.vue
View file @
be21d8e
<template>
<!-- 页面缓存 -->
<router-view v-slot="{ Component }">
<router-view v-slot="{ Component
, route
}">
<keep-alive :include="keepPages">
<component :is="Component" :key="
$
route.name" />
<component :is="Component" :key="route.name" />
</keep-alive>
</router-view>
</template>
...
...
src/components/VideoCard/index.vue
View file @
be21d8e
...
...
@@ -75,28 +75,26 @@ export default {
created() {
},
mounted() {
setTimeout(() => {
var mp = new MuiPlayer({
container: '#mui-player-' + this.item.id,
title: this.item.title,
src: this.item.video,
poster: this.item.cover,
autoFit: false,
videoAttribute: [ // 声明启用同层播放, 不让会自动全屏播放
{ attrKey: 'webkit-playsinline', attrValue: 'webkit-playsinline' },
{ attrKey: 'playsinline', attrValue: 'playsinline' },
{ attrKey: 'x5-video-player-type', attrValue: 'h5-page' },
]
})
this.mp = mp;
this.detail = _.cloneDeep(this.item);
var video = mp.video();
// 监听原生video事件
var _this = this;
video && video.addEventListener('play', function (event) {
_this.handleAction('play', _this.item.id)
});
}, 500);
var mp = new MuiPlayer({
container: '#mui-player-' + this.item.id,
title: this.item.title,
src: this.item.video,
poster: this.item.cover,
autoFit: false,
videoAttribute: [ // 声明启用同层播放, 不让会自动全屏播放
{ attrKey: 'webkit-playsinline', attrValue: 'webkit-playsinline' },
{ attrKey: 'playsinline', attrValue: 'playsinline' },
{ attrKey: 'x5-video-player-type', attrValue: 'h5-page' },
]
})
this.mp = mp;
this.detail = _.cloneDeep(this.item);
var video = mp.video();
// 监听原生video事件
var _this = this;
video && video.addEventListener('play', function (event) {
_this.handleAction('play', _this.item.id)
});
},
methods: {
goTo () { // 跳转作品详情页
...
...
src/store/index.js
View file @
be21d8e
...
...
@@ -13,7 +13,7 @@ export const mainStore = defineStore('main', {
scrollTopCollection
:
0
,
scrollTopLike
:
0
,
scrollTopPerson
:
0
,
keepPages
:
'default'
,
// 很坑爹,空值全部都缓存
keepPages
:
[
'default'
]
,
// 很坑爹,空值全部都缓存
};
},
getters
:
{
...
...
@@ -44,20 +44,13 @@ export const mainStore = defineStore('main', {
this
.
scrollTopPerson
=
v
;
},
changeKeepPages
()
{
// 清空所有缓存,用一个不存在的值覆盖
this
.
keepPages
=
'default'
;
this
.
keepPages
=
[
'default'
]
;
},
keepThisPage
(
page
)
{
// 新增缓存页
const
arr
=
this
.
keepPages
.
split
(
","
);
arr
.
push
(
page
);
this
.
keepPages
=
arr
+
""
;
this
.
keepPages
.
push
(
page
);
},
removeThisPage
(
page
)
{
// 删除缓存页
const
arr
=
this
.
keepPages
.
split
(
","
);
const
index
=
arr
.
findIndex
(
x
=>
x
===
page
);
if
(
index
>
0
)
{
arr
.
splice
(
index
,
1
);
}
this
.
keepPages
=
arr
+
""
;
_
.
remove
(
this
.
keepPages
,
item
=>
item
===
page
)
}
},
});
...
...
Please
register
or
login
to post a comment