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>
|
<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 { DeleteButton, EditButton, SaveButton, UndoButton } from '../button';
|
||||||
|
import { scrollToElement } from 'stores/utils';
|
||||||
// import { useI18n } from 'vue-i18n';
|
// import { useI18n } from 'vue-i18n';
|
||||||
// import { storeToRefs } from 'pinia';
|
// import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
|
|
@ -53,7 +54,15 @@ watch(
|
||||||
await assignClone();
|
await assignClone();
|
||||||
if (!isAdd.value) return;
|
if (!isAdd.value) return;
|
||||||
cloneList.value[cloneList.value.length - 1].isEdit = true;
|
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();
|
inputName.value[cloneList.value.length - 1].focus();
|
||||||
isAdd.value = false;
|
isAdd.value = false;
|
||||||
}, 150);
|
}, 150);
|
||||||
|
|
@ -85,6 +94,7 @@ watch(
|
||||||
lazy-rules="ondemand"
|
lazy-rules="ondemand"
|
||||||
ref="inputName"
|
ref="inputName"
|
||||||
:for="`input-work-name-${index}`"
|
:for="`input-work-name-${index}`"
|
||||||
|
:id="`input-work-name-${index}`"
|
||||||
dense
|
dense
|
||||||
class="col q-mr-md"
|
class="col q-mr-md"
|
||||||
v-model="item.name"
|
v-model="item.name"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue