Vue.js nativescript youtubeplayer在nativescript vue应用程序中全屏切换
我正在尝试在android设备上的nativescript vue应用程序中使用triniwiz/nativescript youtubeplayer插件在youtube播放器中全屏播放,但我无法实现 我有以下代码:Vue.js nativescript youtubeplayer在nativescript vue应用程序中全屏切换,vue.js,nativescript,nativescript-vue,Vue.js,Nativescript,Nativescript Vue,我正在尝试在android设备上的nativescript vue应用程序中使用triniwiz/nativescript youtubeplayer插件在youtube播放器中全屏播放,但我无法实现 我有以下代码: <template> <Page actionBarHidden="true" class="page" > <GridLayout orientation="vertical" width="100%" height="100
<template>
<Page actionBarHidden="true" class="page" >
<GridLayout orientation="vertical" width="100%" height="100%" columns="*" rows="*,auto">
<StackLayout col="0" row="0" backgroundColor="#f8f8f8">
<StackLayout backgroundColor="#44557f">
<Label :text="name" class="font-weight-bold"
color="#FFFFFF" padding="15" fontSize="20" textWrap="true"></Label>
</StackLayout>
<ScrollView orientation="vertical" height="100%">
<ScrollView orientation="vertical">
<StackLayout class="home-panel">
<YoutubePlayer ref="player" :src="videoLink.substring(17)" apiKey="**********" isFullScreen="true"/>
</StackLayout>
</ScrollView>
</ScrollView>
</StackLayout>
</GridLayout>
</Page>
</template>
<script>
export default {
props: ['videoLink','name','id'],
mounted() {
let player = this.$refs.player
player.toggleFullscreen();
}
}
</script>
但我有个错误
未找到toggleFullscreen
通过Ref访问元素时,返回值将是Vue元素。您应该访问nativeView以访问实际元素
<script>
export default {
props: ['videoLink','name','id'],
mounted() {
let player = this.$refs.player.nativeView;
player.toggleFullscreen();
}
}
</script>