feat(category): add scroll when new rule
This commit is contained in:
parent
49de84aad0
commit
01044538a2
1 changed files with 13 additions and 9 deletions
|
|
@ -91,6 +91,7 @@
|
|||
<BModal
|
||||
v-if="form !== null"
|
||||
v-model="formShow"
|
||||
ref="modal"
|
||||
scrollable
|
||||
class="modal-xl"
|
||||
:title="form?.label"
|
||||
|
|
@ -224,18 +225,15 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pt-2">
|
||||
<BButton
|
||||
variant="secondary"
|
||||
@click="form.data[field.key] = doAddRule(form.data[field.key])"
|
||||
>Ajouter règle</BButton
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</BFormGroup>
|
||||
</BForm>
|
||||
<template #footer>
|
||||
<BButton
|
||||
variant="secondary"
|
||||
@click="form.data['rules'] = doAddRule(form.data['rules'])"
|
||||
>Ajouter règle</BButton
|
||||
>
|
||||
<div>
|
||||
<BButton
|
||||
v-if="form.data.id"
|
||||
|
|
@ -285,7 +283,7 @@ import {VueSpinner} from 'vue3-spinners'
|
|||
import SortButton from './../components/SortButton.vue'
|
||||
import Header from './../components/crud/Header.vue'
|
||||
import Pager from './../components/crud/Pager.vue'
|
||||
import {ref, onMounted, watch} from 'vue'
|
||||
import {ref, onMounted, watch, useTemplateRef} from 'vue'
|
||||
import {getStorage, saveStorage} from '../lib/storage'
|
||||
import {renderCategory, renderEuro, renderLabelWithSum} from '../lib/renderers'
|
||||
|
||||
|
|
@ -299,6 +297,7 @@ const pages = ref(null)
|
|||
const form = ref(null)
|
||||
const formShow = ref(false)
|
||||
const applyInProgress = ref(false)
|
||||
const modal = useTemplateRef('modal')
|
||||
|
||||
watch(order, (v) => saveStorage(`${endpoint}:order`, v))
|
||||
watch(sort, (v) => saveStorage(`${endpoint}:sort`, v))
|
||||
|
|
@ -333,6 +332,11 @@ const doAddRule = (item) => {
|
|||
|
||||
item.push(rule)
|
||||
|
||||
window.setTimeout(() => {
|
||||
const modalBody = document.querySelector('.modal-body')
|
||||
modalBody.scrollTo({top: modalBody.scrollHeight, behavior: 'smooth'})
|
||||
}, 300)
|
||||
|
||||
return item
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue