保利威文档中心

帮助中心

话题pk组件

更新时间:2024-04-22 19:18:32

本组件主要用于展示后台管理员发起的话题PK内容。

在引入及使用本功能组件前,需要先对互动功能接收端SDK进行公共配置,详情请查看:互动功能接收端 UI 组件 - 配置 SDK

引入

在线文件引入方式

// script 标签引入,根据版本号引入JS版本。
<script src="https://websdk.videocc.net/interactions-receive-sdk-ui-default/0.24.0/lib/PcTopic/PcTopic.umd.min.js"></script>
// PC端
<script>
    const Topic = window.PolyvIRScene.PcTopic.default;
</script>
// script 标签引入,根据版本号引入JS版本。
<script src="https://websdk.videocc.net/interactions-receive-sdk-ui-default/0.24.0/lib/MobileTopic/MobileTopic.umd.min.js"></script>
// 移动端
<script>
    const Topic = window.PolyvIRScene.MobileTopic.default;
</script>

import 方式引入(推荐)

// PC 端
import Topic from '@polyv/interactions-receive-sdk-ui-default/lib/PcTopic';
// 移动端
import Topic from '@polyv/interactions-receive-sdk-ui-default/lib/MobileTopic';

代码示例

以 PC 端接入为例:

<template>
  <div>
    <Topic
        :lang="lang"
        :topic-sdk="topicSdk"
    />
  </div>
</template>

<script>
import { Topic as TopicSdk} from '@polyv/interactions-receive-sdk';
import Topic from '@polyv/interactions-receive-sdk-ui-default/lib/PcTopic';

export default {
  components: {
    Topic,
  },

  data() {
    return {
      // 话题SDK实例
      topicSdk: null,
    };
  },

  created() {
    this.topicSdk = new TopicSdk();
  },

  beforeDestroy() {
    this.topicSdk?.destroy();
  },
};
</script>

Attributes

属性名 类型 默认值 含义
lang string:'zh_CN', 'en' 'zh_CN' 语言
topic-sdk Object null 话题 SDK 实例
联系客服,在线咨询