CheckBoxModule.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <!-- -->
  2. <template>
  3. <div
  4. class="Big-Book-prev-Textdes CheckboxModule CheckboxModule-phone"
  5. v-if="curQue"
  6. >
  7. <h2 v-if="curQue.title" :style="{ fontSize: baseSizePhone + 2 + 'px' }">
  8. {{ curQue.title }}
  9. </h2>
  10. <el-checkbox
  11. v-model="curQue.Bookanswer[index]"
  12. v-for="(item, index) in curQue.option"
  13. :key="index"
  14. :readonly="TaskModel == 'ANSWER'"
  15. >{{ item.con }}</el-checkbox
  16. >
  17. </div>
  18. </template>
  19. <script>
  20. export default {
  21. components: {},
  22. props: ["curQue", "TaskModel", "baseSizePhone"],
  23. data() {
  24. return {
  25. userList: []
  26. };
  27. },
  28. computed: {},
  29. watch: {},
  30. //方法集合
  31. methods: {
  32. handleData() {
  33. let _this = this;
  34. let userList = [];
  35. _this.curQue.option.forEach(item => {
  36. userList.push(false);
  37. });
  38. if (!this.curQue.Bookanswer) {
  39. this.$set(this.curQue, "Bookanswer", userList);
  40. }
  41. }
  42. },
  43. //生命周期 - 创建完成(可以访问当前this实例)
  44. created() {
  45. this.handleData();
  46. },
  47. //生命周期 - 挂载完成(可以访问DOM元素)
  48. mounted() {},
  49. beforeCreate() {}, //生命周期 - 创建之前
  50. beforeMount() {}, //生命周期 - 挂载之前
  51. beforeUpdate() {}, //生命周期 - 更新之前
  52. updated() {}, //生命周期 - 更新之后
  53. beforeDestroy() {}, //生命周期 - 销毁之前
  54. destroyed() {}, //生命周期 - 销毁完成
  55. activated() {} //如果页面有keep-alive缓存功能,这个函数会触发
  56. };
  57. </script>
  58. <style lang="scss" scoped>
  59. //@import url(); 引入公共css类
  60. .CheckboxModule {
  61. width: 100%;
  62. margin: 0;
  63. h2 {
  64. margin: 8px 0;
  65. font-size: 16px;
  66. line-height: 150%;
  67. color: #000000;
  68. }
  69. .el-checkbox {
  70. width: 100%;
  71. margin: 4px 0;
  72. }
  73. }
  74. </style>
  75. <style lang="scss">
  76. .CheckboxModule {
  77. .el-checkbox__label,
  78. .el-checkbox__input.is-checked + .el-checkbox__label {
  79. color: #000000;
  80. font-size: 16px;
  81. line-height: 1.5;
  82. font-weight: normal;
  83. }
  84. .el-checkbox__inner {
  85. border-color: #4d91f6;
  86. background: transparent;
  87. }
  88. }
  89. .CheckboxModule-phone {
  90. .el-checkbox {
  91. display: flex;
  92. align-items: flex-start;
  93. }
  94. .el-checkbox__label {
  95. white-space: normal;
  96. word-break: break-word;
  97. }
  98. .el-checkbox__input {
  99. margin-top: 5px;
  100. }
  101. }
  102. </style>