嗨,我使用surveyjs创建我的反应调查,我需要一个问题类型,它是自定义小部件:Select2 tagbox questiontype,但我没有尝试任何工作。有没有人能够解决这个问题,即使我将“类型”更改为“细胞类型”也不起作用,我无法弄清楚可能是什么问题。如果有人能够提供帮助,将不胜感激。
下面是我的代码。
import React,{Component} from 'react';
import './App.css';
import "survey-react/survey.css"
import * as Survey from "survey-react"
import "surveyjs-widgets"
class App extends Component {
constructor (props){
super(props)
this.state = {
}
this.onCompleteComponent = this.onCompleteComponent.bind(this)
}
onCompleteComponent = () =>{
this.setState({
isCompleted: true
})
}
render(){
var json = {
clearInvisibleValues: "onHidden",
questions: [
{ //question 1
type: "tagbox",
name: "roles",
title: "Roles with non-portable work",
choices: [
"Role1",
"Role2",
"Role3"
],
colCount: 0
}
};
]
};
var surveyRender= !this.state.isCompleted ? (
<Survey.Survey
json={json}
showCompletedPage={false}
onComplete={this.onCompleteComponent}
/>
) : null
var onSurveyCompletion = this.state.isCompleted?(
<div>Thank you for your participation in this survey!</div>
) : null;
return (
<div className="App">
<div>
{surveyRender}
{onSurveyCompletion}
</div>
</div>
);
}
}
export default App;