Commit 2fd57d1fe8b626446bf34c12aa0f6a5a36f16220
1 parent
f3d1c4ce
wip: 代码提交
Showing
2 changed files
with
17 additions
and
0 deletions
src/views/basic/askTestQuestion/components/analysisDialog.vue
... | ... | @@ -69,6 +69,21 @@ export default { |
69 | 69 | firstP.innerHTML = a; |
70 | 70 | } |
71 | 71 | }, |
72 | + processString(input) { | |
73 | + // 正则表达式:匹配最多三位数字 | |
74 | + const regex = /^(\d{1,3})/; | |
75 | + | |
76 | + // 测试字符串是否以数字开头 | |
77 | + const match = input.match(regex); | |
78 | + | |
79 | + if (match) { | |
80 | + // 如果匹配,去掉开头的数字并返回剩余部分 | |
81 | + return input.substring(match[0].length + 1).trim(); | |
82 | + } | |
83 | + | |
84 | + // 如果没有匹配,直接返回原字符串 | |
85 | + return input; | |
86 | + }, | |
72 | 87 | }, |
73 | 88 | }; |
74 | 89 | </script> | ... | ... |
src/views/basic/askTestQuestion/wrongQuestion.vue