|
@@ -64,61 +64,76 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
watch: {
|
|
|
- 'data.property.column_num': {
|
|
|
- handler(val) {
|
|
|
- let optionNum = this.data.option_list[0].length;
|
|
|
- if (val > optionNum) {
|
|
|
- // 修改序号类型列表
|
|
|
- this.data.property.serial_number_type_list.push(
|
|
|
- serialNumberTypeList[val]?.value || serialNumberTypeList[0].value,
|
|
|
- );
|
|
|
- // 增加选项
|
|
|
- for (let i = 0; i < this.data.option_list.length; i++) {
|
|
|
- this.data.option_list[i].push(getOptionItem());
|
|
|
+ 'data.property.column_num': [
|
|
|
+ {
|
|
|
+ handler(val) {
|
|
|
+ let optionNum = this.data.option_list[0].length;
|
|
|
+ if (val > optionNum) {
|
|
|
+ // 修改序号类型列表
|
|
|
+ this.data.property.serial_number_type_list.push(
|
|
|
+ serialNumberTypeList[val]?.value || serialNumberTypeList[0].value,
|
|
|
+ );
|
|
|
+ // 增加选项
|
|
|
+ for (let i = 0; i < this.data.option_list.length; i++) {
|
|
|
+ this.data.option_list[i].push(getOptionItem());
|
|
|
+ }
|
|
|
+ // 修改答案列表
|
|
|
+ this.data.answer.answer_list.forEach((li) => {
|
|
|
+ li.push({ mark: '' });
|
|
|
+ });
|
|
|
+ return;
|
|
|
}
|
|
|
- // 修改答案列表
|
|
|
- this.data.answer.answer_list.forEach((li) => {
|
|
|
- li.push({ mark: '' });
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- if (val < optionNum) {
|
|
|
- this.data.property.serial_number_type_list.splice(-1, 1);
|
|
|
- this.data.option_list.forEach((li) => {
|
|
|
- li.splice(-1, 1);
|
|
|
- });
|
|
|
- // 修改答案列表
|
|
|
- this.data.answer.answer_list.forEach((li) => {
|
|
|
- li.splice(-1, 1);
|
|
|
- });
|
|
|
- }
|
|
|
+ if (val < optionNum) {
|
|
|
+ this.data.property.serial_number_type_list.splice(-1, 1);
|
|
|
+ this.data.option_list.forEach((li) => {
|
|
|
+ li.splice(-1, 1);
|
|
|
+ });
|
|
|
+ // 修改答案列表
|
|
|
+ this.data.answer.answer_list.forEach((li) => {
|
|
|
+ li.splice(-1, 1);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
- },
|
|
|
- 'data.property.row_num': {
|
|
|
- handler(val) {
|
|
|
- let optionNum = this.data.option_list.length;
|
|
|
- if (val > optionNum) {
|
|
|
- for (let i = 0; i < val - optionNum; i++) {
|
|
|
- this.data.option_list.push(getOption(this.data.property.column_num));
|
|
|
+ 'handlerMindMap',
|
|
|
+ ],
|
|
|
+ 'data.property.row_num': [
|
|
|
+ {
|
|
|
+ handler(val) {
|
|
|
+ let optionNum = this.data.option_list.length;
|
|
|
+ if (val > optionNum) {
|
|
|
+ for (let i = 0; i < val - optionNum; i++) {
|
|
|
+ this.data.option_list.push(getOption(this.data.property.column_num));
|
|
|
+ }
|
|
|
+ // 增加答案列表
|
|
|
+ this.data.answer.answer_list.push(
|
|
|
+ Array.from({ length: this.data.property.column_num }, () => ({ mark: '' })),
|
|
|
+ );
|
|
|
+ // 将答案列表最后一项的第一个元素设置进答案列表第一项
|
|
|
+ this.data.answer.answer_list[this.data.answer.answer_list.length - 1][0] = {
|
|
|
+ mark: this.data.option_list[this.data.option_list.length - 1][0].mark,
|
|
|
+ };
|
|
|
+ return;
|
|
|
}
|
|
|
- // 增加答案列表
|
|
|
- this.data.answer.answer_list.push(
|
|
|
- Array.from({ length: this.data.property.column_num }, () => ({ mark: '' })),
|
|
|
- );
|
|
|
- // 将答案列表最后一项的第一个元素设置进答案列表第一项
|
|
|
- this.data.answer.answer_list[this.data.answer.answer_list.length - 1][0] = {
|
|
|
- mark: this.data.option_list[this.data.option_list.length - 1][0].mark,
|
|
|
- };
|
|
|
- return;
|
|
|
- }
|
|
|
- if (val < optionNum) {
|
|
|
- this.data.option_list.splice(val);
|
|
|
- this.data.answer.answer_list.splice(val);
|
|
|
- }
|
|
|
+ if (val < optionNum) {
|
|
|
+ this.data.option_list.splice(val);
|
|
|
+ this.data.answer.answer_list.splice(val);
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
+ 'handlerMindMap',
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /**
|
|
|
+ * @description 处理思维导图
|
|
|
+ */
|
|
|
+ handlerMindMap() {
|
|
|
+ this.data.mind_map.node_list = [
|
|
|
+ { name: `${this.data.property.row_num}行${this.data.property.column_num}列连线组件` },
|
|
|
+ ];
|
|
|
},
|
|
|
},
|
|
|
- methods: {},
|
|
|
};
|
|
|
</script>
|
|
|
|