Skip to content

Commit

Permalink
修复无法点击“下一题”按钮的情况
Browse files Browse the repository at this point in the history
  • Loading branch information
Super12138 committed Sep 27, 2024
1 parent 618d1e2 commit b176a6d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'mdui/components/radio.js';

import type { Button } from 'mdui/components/button.js';
import type { LinearProgress } from 'mdui/components/linear-progress.js';
import type { RadioGroup } from 'mdui/components/radio-group.js';
import type { TopAppBarTitle } from 'mdui/components/top-app-bar-title.js';

import '@mdui/icons/arrow-back--outlined.js';
Expand Down Expand Up @@ -137,16 +138,16 @@ document.addEventListener('testPageLoaded', async () => {
};

function checkQuestionChecked(id: number) {
const checkQuestion = questions[id].html.querySelector('mdui-radio-group')!;
if (checkQuestion.value) {
const radioGroup: RadioGroup = document.querySelector(`#questions-${id}`)!;
if (radioGroup.value) {
nextBtn.disabled = false;
} else {
nextBtn.disabled = true;
const radioChangeListener = () => {
nextBtn.disabled = false;
checkQuestion.removeEventListener('change', radioChangeListener);
radioGroup.removeEventListener('change', radioChangeListener);
};
checkQuestion.addEventListener('change', radioChangeListener);
radioGroup.addEventListener('change', radioChangeListener);
}
}

Expand Down

0 comments on commit b176a6d

Please sign in to comment.