fix scroll to new workname
This commit is contained in:
parent
59f3af101a
commit
c86a755643
1 changed files with 12 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
<script lang="ts" setup>
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import { nextTick, onMounted, ref, watch } from 'vue';
|
||||
import { DeleteButton, EditButton, SaveButton, UndoButton } from '../button';
|
||||
import { scrollToElement } from 'stores/utils';
|
||||
// import { useI18n } from 'vue-i18n';
|
||||
// import { storeToRefs } from 'pinia';
|
||||
|
||||
|
|
@ -53,7 +54,15 @@ watch(
|
|||
await assignClone();
|
||||
if (!isAdd.value) return;
|
||||
cloneList.value[cloneList.value.length - 1].isEdit = true;
|
||||
setTimeout(() => {
|
||||
setTimeout(async () => {
|
||||
await nextTick();
|
||||
|
||||
const scrollTarget = document.getElementById(
|
||||
`input-work-name-${cloneList.value.length - 1}`,
|
||||
);
|
||||
if (scrollTarget)
|
||||
scrollTarget.scrollIntoView({ behavior: 'instant', inline: 'center' });
|
||||
|
||||
inputName.value[cloneList.value.length - 1].focus();
|
||||
isAdd.value = false;
|
||||
}, 150);
|
||||
|
|
@ -85,6 +94,7 @@ watch(
|
|||
lazy-rules="ondemand"
|
||||
ref="inputName"
|
||||
:for="`input-work-name-${index}`"
|
||||
:id="`input-work-name-${index}`"
|
||||
dense
|
||||
class="col q-mr-md"
|
||||
v-model="item.name"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue