Skip to content

Commit b205bbb

Browse files
committed
✨ feat: 光标自动聚焦到文本域
1 parent f1d3361 commit b205bbb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/HomeView.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const settingsStore = useSettingsStore();
1616
1717
const selectedType = ref('feat');
1818
const commitMessage = ref('');
19+
const commitMessageInput = ref(null);
1920
const scope = ref('');
2021
const contributors = ref('');
2122
const issueId = ref('');
@@ -65,6 +66,10 @@ watch(
6566
6667
onMounted(() => {
6768
selectTypeFromAction(props.enterAction);
69+
// 自动聚焦到输入框
70+
if (commitMessageInput.value) {
71+
commitMessageInput.value.focus();
72+
}
6873
});
6974
7075
const autoClassifyCommitType = (description) => {
@@ -217,7 +222,8 @@ const copyText = (text) => {
217222
placeholder="问题ID(可选)" />
218223
</div>
219224
<div class="row2" style="display: flex;padding: 10px; align-items: center;width: 80vw;">
220-
<a-textarea v-model:value="commitMessage" allowClear placeholder="输入提交信息概述" :rows="3" />
225+
<a-textarea ref="commitMessageInput" v-model:value="commitMessage" allowClear placeholder="输入提交信息概述"
226+
:rows="3" />
221227
</div>
222228
223229
<div class="row3" style="display: flex;padding: 10px; flex-direction: column;">

0 commit comments

Comments
 (0)