video.nvue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <view class="content">
  3. <!-- #ifdef APP-PLUS -->
  4. <ad-content-page class="ad-content-page" ref="adContentPage" :adpid="adpid" @load="onadload" @error="onaderror"></ad-content-page>
  5. <!-- #endif -->
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. data() {
  11. return {
  12. title: 'ad-content-page',
  13. adpid:''
  14. }
  15. },
  16. onShow() {
  17. // #ifdef APP-PLUS
  18. if(uni.getStorageSync("config")){
  19. this.adpid=uni.getStorageSync("config").site.appapi.dspadpid
  20. console.log(this.adpid)
  21. }
  22. this.$nextTick(() => {
  23. // 需要在页面显示时调用广告组件的 show 方法
  24. this.$refs.adContentPage.show();
  25. })
  26. // #endif
  27. },
  28. onUnload() {
  29. // #ifdef APP-PLUS
  30. // 需要在页面隐藏时调用广告组件的 hide 方法停止广告内容的声音
  31. this.$refs.adContentPage.hide();
  32. // #endif
  33. },
  34. onHide() {
  35. // #ifdef APP-PLUS
  36. // 需要在页面隐藏时调用广告组件的 hide 方法停止广告内容的声音
  37. this.$refs.adContentPage.hide();
  38. // #endif
  39. },
  40. methods: {
  41. onadload(e) {
  42. console.log("onadload",e);
  43. },
  44. onaderror(e) {
  45. console.log("onaderror",e);
  46. }
  47. }
  48. }
  49. </script>
  50. <style>
  51. .content {
  52. flex: 1
  53. }
  54. .ad-content-page {
  55. flex: 1
  56. }
  57. </style>