Notice
Updated: 2021-12-22 10:45:54
Import Component
import Notice from '@polyv/interactions-launch-sdk-ui-default/lib/Notice';
Code Example
<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
| Attribute | Type | Default | Description |
|---|---|---|---|
| core | Object | null | Notice SDK instance |
| lang | 'zh_CN' | 'en' | 'zh_CN' | Language pack type |
| isSimpleMode | Boolean | false | Whether it is simple mode. By default, the notice component includes: editing and publishing notices, removing notices, and displaying the latest notice in the room. In simple mode, only editing and publishing notices are included. Other functions need to be handled by calling the interface yourself. |
Events
| Event | Description | Callback Parameters |
|---|---|---|
| close | If the attribute isSimpleMode is true, the notice component can be hidden in this event callback. | {type:'published'|'cancelPublish'} Indicates that the trigger timing is "new notice received" and "notice publication cancelled", respectively. |
