修改youtube的加载方式, 在组件中加载youtube组件, 修改nft和gameplay的路由加载方式
This commit is contained in:
parent
c3dd9c5f86
commit
db5d48f67a
@ -4,7 +4,7 @@
|
|||||||
<div class="video-cover">
|
<div class="video-cover">
|
||||||
<img src="@/assets/202202/gameplay/video.jpg" alt="video">
|
<img src="@/assets/202202/gameplay/video.jpg" alt="video">
|
||||||
</div>
|
</div>
|
||||||
<youtube
|
<you-tube-player
|
||||||
v-show="videoShow"
|
v-show="videoShow"
|
||||||
class="video-youtube-202202"
|
class="video-youtube-202202"
|
||||||
:class="{'mobile': mobile}"
|
:class="{'mobile': mobile}"
|
||||||
@ -14,17 +14,19 @@
|
|||||||
:player-height="videoHeight"
|
:player-height="videoHeight"
|
||||||
@ready="videoReady"
|
@ready="videoReady"
|
||||||
@ended="videoEnded"
|
@ended="videoEnded"
|
||||||
></youtube>
|
></you-tube-player>
|
||||||
<div class="play-btn" @click="showVideo" v-show="!videoShow"></div>
|
<div class="play-btn" @click="showVideo" v-show="!videoShow"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Vue } from 'vue-property-decorator'
|
import { Component, Vue } from 'vue-property-decorator'
|
||||||
import { AppModule, DeviceType } from '@/store/modules/app'
|
import { AppModule, DeviceType } from '@/store/modules/app'
|
||||||
|
import Youtube, { YouTubePlayer } from 'vue-youtube-embed'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'VideoSection',
|
name: 'VideoSection',
|
||||||
components: {
|
components: {
|
||||||
|
YouTubePlayer
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
@ -39,6 +41,10 @@ export default class extends Vue {
|
|||||||
controls: 0
|
controls: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
beforeMount() {
|
||||||
|
Youtube.install(Vue)
|
||||||
|
}
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
// {375, 146}
|
// {375, 146}
|
||||||
const winWidth = window.innerWidth
|
const winWidth = window.innerWidth
|
||||||
|
@ -17,15 +17,15 @@
|
|||||||
<div class="bottom-cover"></div>
|
<div class="bottom-cover"></div>
|
||||||
<div class="video-bg" v-show="videoShow" @click="hideVideo"></div>
|
<div class="video-bg" v-show="videoShow" @click="hideVideo"></div>
|
||||||
<div class="video-div" ref="videoDiv" v-show="videoShow" >
|
<div class="video-div" ref="videoDiv" v-show="videoShow" >
|
||||||
<youtube
|
<!-- <youtube-->
|
||||||
class="video-youtube"
|
<!-- class="video-youtube"-->
|
||||||
video-id="_SZ5pVCxmro"
|
<!-- video-id="_SZ5pVCxmro"-->
|
||||||
:player-vars="playerVars"
|
<!-- :player-vars="playerVars"-->
|
||||||
:player-width="videoWidth"
|
<!-- :player-width="videoWidth"-->
|
||||||
:player-height="videoHeight"
|
<!-- :player-height="videoHeight"-->
|
||||||
@ready="videoReady"
|
<!-- @ready="videoReady"-->
|
||||||
@ended="videoEnded"
|
<!-- @ended="videoEnded"-->
|
||||||
></youtube>
|
<!-- ></youtube>-->
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<section id="video_section" ref="videoSection" data-anchor="video">
|
<section id="video_section" ref="videoSection" data-anchor="video">
|
||||||
<youtube
|
<you-tube-player
|
||||||
class="video-youtube"
|
class="video-youtube"
|
||||||
video-id="_SZ5pVCxmro"
|
video-id="_SZ5pVCxmro"
|
||||||
:player-vars="playerVars"
|
:player-vars="playerVars"
|
||||||
@ -8,17 +8,18 @@
|
|||||||
:player-height="videoHeight"
|
:player-height="videoHeight"
|
||||||
@ready="videoReady"
|
@ready="videoReady"
|
||||||
@ended="videoEnded"
|
@ended="videoEnded"
|
||||||
></youtube>
|
></you-tube-player>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Vue } from 'vue-property-decorator'
|
import { Component, Vue } from 'vue-property-decorator'
|
||||||
|
import Youtube, { YouTubePlayer } from 'vue-youtube-embed'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'VideoSection',
|
name: 'VideoSection',
|
||||||
components: {
|
components: {
|
||||||
|
YouTubePlayer
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
@ -37,6 +38,8 @@ export default class extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
|
console.log('11')
|
||||||
|
Youtube.install(Vue)
|
||||||
window.addEventListener('resize', this.resizeHandler)
|
window.addEventListener('resize', this.resizeHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,13 +5,11 @@ import 'element-ui/lib/theme-chalk/index.css'
|
|||||||
import router from './router'
|
import router from './router'
|
||||||
import store from './store'
|
import store from './store'
|
||||||
import VueClipboard from 'vue-clipboard2'
|
import VueClipboard from 'vue-clipboard2'
|
||||||
import VueYouTubeEmbed from 'vue-youtube-embed'
|
|
||||||
|
|
||||||
// Vue.use(ElementUI)
|
// Vue.use(ElementUI)
|
||||||
Vue.use(Loading.directive)
|
Vue.use(Loading.directive)
|
||||||
Vue.use(Slider)
|
Vue.use(Slider)
|
||||||
|
|
||||||
Vue.use(VueYouTubeEmbed)
|
|
||||||
Vue.use(VueClipboard)
|
Vue.use(VueClipboard)
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ import Item from '../views/desktop/Item.vue'
|
|||||||
import MyNft from '@/views/desktop/MyNft.vue'
|
import MyNft from '@/views/desktop/MyNft.vue'
|
||||||
import Index from '@/views/desktop/Index.vue'
|
import Index from '@/views/desktop/Index.vue'
|
||||||
import Presale from '@/views/desktop/Presale.vue'
|
import Presale from '@/views/desktop/Presale.vue'
|
||||||
import NFT from '@/views/desktop/NFT.vue'
|
|
||||||
import Gameplay from '@/views/desktop/Gameplay.vue'
|
import Gameplay from '@/views/desktop/Gameplay.vue'
|
||||||
import Tokenomic from '@/views/desktop/Tokenomic.vue'
|
import Tokenomic from '@/views/desktop/Tokenomic.vue'
|
||||||
import Team from '@/views/desktop/Team.vue'
|
import Team from '@/views/desktop/Team.vue'
|
||||||
@ -15,7 +14,6 @@ import MobileIndex from '@/views/mobile/Index.vue'
|
|||||||
import { AppModule, DeviceType } from '@/store/modules/app'
|
import { AppModule, DeviceType } from '@/store/modules/app'
|
||||||
import { isMobile } from '@/utils/resize'
|
import { isMobile } from '@/utils/resize'
|
||||||
import MobileGameplay from '@/views/mobile/Gameplay.vue'
|
import MobileGameplay from '@/views/mobile/Gameplay.vue'
|
||||||
import MobileNft from '@/views/mobile/NFT.vue'
|
|
||||||
import MobileTokennomic from '@/views/mobile/Tokenomic.vue'
|
import MobileTokennomic from '@/views/mobile/Tokenomic.vue'
|
||||||
import MobileTeam from '@/views/mobile/Team.vue'
|
import MobileTeam from '@/views/mobile/Team.vue'
|
||||||
import MobileRoadmap from '@/views/mobile/Roadmap.vue'
|
import MobileRoadmap from '@/views/mobile/Roadmap.vue'
|
||||||
@ -77,7 +75,8 @@ const routes: Array<RouteConfig> = [
|
|||||||
{
|
{
|
||||||
path: '/nft',
|
path: '/nft',
|
||||||
name: 'Nft',
|
name: 'Nft',
|
||||||
component: mobile ? MobileNft : NFT,
|
// component: mobile ? MobileNft : NFT,
|
||||||
|
component: resolve => mobile ? require(['@/views/mobile/NFT.vue'], resolve) : require(['@/views/desktop/NFT.vue'], resolve),
|
||||||
alias: '/nft/index.html',
|
alias: '/nft/index.html',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'NFT | CEBG: CRYPTO ELITE‘S BATTLEGROUNDS',
|
title: 'NFT | CEBG: CRYPTO ELITE‘S BATTLEGROUNDS',
|
||||||
@ -96,7 +95,7 @@ const routes: Array<RouteConfig> = [
|
|||||||
{
|
{
|
||||||
path: '/gameplay',
|
path: '/gameplay',
|
||||||
name: 'Gameplay',
|
name: 'Gameplay',
|
||||||
component: mobile ? MobileGameplay : Gameplay,
|
component: resolve => mobile ? require(['@/views/mobile/Gameplay.vue'], resolve) : require(['@/views/desktop/Gameplay.vue'], resolve),
|
||||||
alias: '/gameplay/index.html',
|
alias: '/gameplay/index.html',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'Gameplay | CEBG: CRYPTO ELITE‘S BATTLEGROUNDS',
|
title: 'Gameplay | CEBG: CRYPTO ELITE‘S BATTLEGROUNDS',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user