保利威文档中心

幫助中心

Notice 公告

更新時間:2021-12-22 10:45:54

引入元件

import Notice from '@polyv/interactions-launch-sdk-ui-default/lib/Notice';

程式碼範例

<template>
    <div>
    <button @click="noticeVisible = true">公告</button>
    <!-- 建议弹窗宽度为 560px,弹窗内容高度为 350px -->
    <el-dialog
      v-if="noticeCore"
      class="c-interactions-lottery"
      :custom-class="'c-interactions-dialog c-interactions-dialog__h350'"
      width="560px"
      title="公告"
      :visible.sync="noticeVisible"
      :close-on-click-modal="false"
    >
      <notice
        :lang="lang"
        :core="noticeCore"
      />
    </el-dialog>
  </div>
</template>

<script>
import * as InteractionsLaunchSDK from '@polyv/interactions-launch-sdk';
import Notice from '@polyv/interactions-launch-sdk-ui-default/lib/Notice';

export default {
  components: {
    Notice,
  },
  data() {
    return {
      // 中英文设置 'zh_CN'/'en'
      lang: 'zh_CN',
      noticeVisible: false,
      // 公告 SDK 实例
      noticeCore: null,
    };
  },
  mounted() {
    // TODO: 关于初始化 InteractionsLaunchSDK 的其他设置
    this.noticeCore = new InteractionsLaunchSDK.Notice();
  },
};
</script>

Attributes

屬性名 類型 預設值 含義
core Object null 公告 SDK 實例
lang 'zh_CN'|'en' 'zh_CN' 語言套件類型
isSimpleMode Boolean false 是否為簡易模式。預設情況下,公告元件包含功能:編輯發布公告、移除公告、顯示房間內最新公告。為簡易模式時,只包含編輯發布公告功能。其他功能需自行呼叫介面進行處理。

Events

事件名 說明 回呼參數
close 如果屬性 isSimpleMode 為 true,可以在該事件回呼中隱藏公告元件。 {type:'published'|'cancelPublish'}
分別表示觸發事件的時機為「收到新公告」和「取消發布公告」。
联系客服,在线咨询