Questionnaire 問卷
更新時間:2022-08-16 14:47:23
引入元件
import QuestionnaireNew from '@polyv/interactions-launch-sdk-ui-default/lib/QuestionnaireNew';
程式碼範例
<template>
<!-- 建议弹窗宽度为 720px,弹窗内容高度为 500px -->
<el-dialog
:custom-class="'c-interactions-dialog c-interactions-dialog__h500'"
width="720px"
title="问卷"
:visible.sync="questionnaireVisible"
:close-on-click-modal="false"
>
<QuestionnaireNew
:lang="lang"
:core="questionnaireCore"
/>
</el-dialog>
</template>
<script>
import QuestionnaireNew from '@polyv/interactions-launch-sdk-ui-default/lib/QuestionnaireNew';
import * as InteractionsLaunchSDK from '@polyv/interactions-launch-sdk';
// 弹窗组件可以选择其他 UI 库组件或自行开发,这里没有限制。
import { Dialog } from 'element-ui';
export default {
components: {
ElDialog: Dialog,
QuestionnaireNew,
},
data() {
return {
// 中英文设置 'zh_CN'/'en'
lang: 'zh_CN',
questionnaireCore: null,
questionnaireVisible: false,
// 需要显示结果的题目 id
questionnaireResultId: '',
};
},
mounted() {
// TODO: 关于初始化 InteractionsLaunchSDK 的其他设置
this.questionnaireCore = new InteractionsLaunchSDK.Questionnaire();
}
}
</script>
Attributes
| 屬性名 | 類型 | 預設值 | 含義 |
|---|---|---|---|
| core | Object | null | 問卷 SDK 實例 |
| lang | 'zh_CN'|'en' | 'zh_CN' | 語言套件類型 |
| canStart | Boolean | true | 當前是否可以發起互動。 |
| cantStartTips | String | '當前不可以發起互動' | 如果當前不可以發起互動,點擊發起按鈕時的提示文案。 |
