1.2.2 • Published 2 years ago

luca-h5-scale v1.2.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

luca-h5-scale

简体中文 | English

基于 antd-mobie 的量表组件,只适用于 h5

直接打开浏览器查看 https://gitee.com/AnnasSong/luca-h5-scale.git

使用教程

yarn add luca-h5-scale

import { ScaleComponent } from "luca-h5-scale";
export default class Demo extends Component {
  /*
  @@params : questions 题目数组
  example : [
    {
      title : '例子'  //题目名称,
      tip : '提示', //名称下面的小提示,
      type : 'CHOICE' // 题目类型,根据量表模块,现在只有单选题类型,点击选完后自动跳到下一步,
      autoNext : true , //是否隐藏下一步按钮并自动进行下一步,
      config : {
        options : [],

      }, // 存放着各个题型所需要的配置属性,目前只写单选题的配置项例子
    }
  ]
*/

const options =[Bearer
  {
    title: "咳嗽有多频繁?",
    tip: "请按照慢阻肺对您生活各方面影响的严重程度选择,0为完全没影响,5为影响最严重",
    type: "CHIOCE",
    autoNext: true,
    config: {
      options: [
        {
          value: "1531525777902936064",
          label: "0 从不咳嗽",
          id: "948",
          code: "1531525777902936064",
          questionCode: "1531525777236041728",
          content: "0 从不咳嗽",
          score: 0,
          sortNumber: 0
        },
        {
          value: "1531525777949073408",
          label: "1",
          id: "949",
          code: "1531525777949073408",
          questionCode: "1531525777236041728",
          content: "1",
          score: 1,
          sortNumber: 0
        }
      ]
    }
  }
]
  const handleSubmit = (v)=>{
    console.log(v)
  }
  render() {
    return (
      //需要在外层包裹一个标签给出固定高度
       <div style={{ height: "100vh" }}>
          <ScaleComponent
          questions={questions}
          handleSubmit={handleSubmit}
        ></ScaleComponent>
        </div>

    );
  }
}