无法在模式页脚的 bootstrap-vue 列中居中 select 列表和分页器
Unable to center select list and paginator inside bootstrap-vue column in modal footer
我试图在 bootstrap-vue modal 内的页脚作用域插槽内对齐一些项目,出于某种原因,无论我尝试什么,我都无法将一列中的内容移动到右侧
<template #modal-footer="{ ok, cancel }">
<div class="row w-100">
<div class="col-9 text-right border border-primary">
<b-form inline class="d-flex">
<b-form-select class="justify-content-end"
v-model="perPage"
:options="pagerSelectOptions"
>
</b-form-select>
<b-pagination
v-model="currentPage"
:total-rows="totalRows"
:per-page="perPage"
size="md"
hide-goto-end-buttons
></b-pagination>
</b-form>
</div>
<div class="col-3 text-right border border-primary">
<b-button class="mr-4"
:disabled="restoreButtonDisabled"
dusk="deleted-pursuit-restore-ok-button"
variant="primary"
@click="restore"
>
<b-spinner
v-if="loading"
small
type="grow"
>
</b-spinner>
{{ restoreButtonText }} <b-badge
v-if="selectedPursuits.length > 0"
variant="outline-primary"
>{{ selectedPursuits.length }}
</b-badge>
</b-button>
<b-button
:disabled="loading"
@click="cancelModal"
dusk="deleted-pursuit-restore-cancel-button"
>
Cancel
</b-button>
</div>
</div>
</template>
这是现在的样子(边框只是为了突出显示列)。
我只想将 select 和页面居中放在左栏中。我已经尝试了每个 justify
变体和其他 class 选项,但我无法让这些项目让步。我需要做什么才能使项目在列中居中?
我认为问题在于 bootstrap-vue 分页中的 ul
有一个 margin
覆盖了之前的道具。您可以通过将分页 margin
设置为 0(即 m-0
bootstrap 方式)并手动将 margin/padding 应用于其他元素以使其看起来不错来解决此问题。所以,像这样:
<template #modal-footer="{ ok, cancel }">
<div class="row mx-2">
<div class="col-9 text-right border border-primary d-flex justify-content-center py-2">
<b-form inline>
<b-form-select class="justify-content-end"
v-model="perPage"
:options="pagerSelectOptions"
>
</b-form-select>
<b-pagination
class="m-0"
v-model="currentPage"
:total-rows="totalRows"
:per-page="perPage"
size="md"
hide-goto-end-buttons
></b-pagination>
</b-form>
</div>
<div class="col-3 text-right border border-primary border-left-0 py-2">
<b-button class=""
:disabled="restoreButtonDisabled"
dusk="deleted-pursuit-restore-ok-button"
variant="primary"
@click="restore"
>
<b-spinner
v-if="loading"
small
type="grow"
>
</b-spinner>
{{ restoreButtonText }}
<b-badge
v-if="selectedPursuits.length > 0"
variant="outline-primary"
>{{ selectedPursuits.length }}
</b-badge>
</b-button>
<b-button
:disabled="loading"
@click="cancelModal"
dusk="deleted-pursuit-restore-cancel-button"
>
Cancel
</b-button>
</div>
</div>
</template>
我试图在 bootstrap-vue modal 内的页脚作用域插槽内对齐一些项目,出于某种原因,无论我尝试什么,我都无法将一列中的内容移动到右侧
<template #modal-footer="{ ok, cancel }">
<div class="row w-100">
<div class="col-9 text-right border border-primary">
<b-form inline class="d-flex">
<b-form-select class="justify-content-end"
v-model="perPage"
:options="pagerSelectOptions"
>
</b-form-select>
<b-pagination
v-model="currentPage"
:total-rows="totalRows"
:per-page="perPage"
size="md"
hide-goto-end-buttons
></b-pagination>
</b-form>
</div>
<div class="col-3 text-right border border-primary">
<b-button class="mr-4"
:disabled="restoreButtonDisabled"
dusk="deleted-pursuit-restore-ok-button"
variant="primary"
@click="restore"
>
<b-spinner
v-if="loading"
small
type="grow"
>
</b-spinner>
{{ restoreButtonText }} <b-badge
v-if="selectedPursuits.length > 0"
variant="outline-primary"
>{{ selectedPursuits.length }}
</b-badge>
</b-button>
<b-button
:disabled="loading"
@click="cancelModal"
dusk="deleted-pursuit-restore-cancel-button"
>
Cancel
</b-button>
</div>
</div>
</template>
这是现在的样子(边框只是为了突出显示列)。
我只想将 select 和页面居中放在左栏中。我已经尝试了每个 justify
变体和其他 class 选项,但我无法让这些项目让步。我需要做什么才能使项目在列中居中?
我认为问题在于 bootstrap-vue 分页中的 ul
有一个 margin
覆盖了之前的道具。您可以通过将分页 margin
设置为 0(即 m-0
bootstrap 方式)并手动将 margin/padding 应用于其他元素以使其看起来不错来解决此问题。所以,像这样:
<template #modal-footer="{ ok, cancel }">
<div class="row mx-2">
<div class="col-9 text-right border border-primary d-flex justify-content-center py-2">
<b-form inline>
<b-form-select class="justify-content-end"
v-model="perPage"
:options="pagerSelectOptions"
>
</b-form-select>
<b-pagination
class="m-0"
v-model="currentPage"
:total-rows="totalRows"
:per-page="perPage"
size="md"
hide-goto-end-buttons
></b-pagination>
</b-form>
</div>
<div class="col-3 text-right border border-primary border-left-0 py-2">
<b-button class=""
:disabled="restoreButtonDisabled"
dusk="deleted-pursuit-restore-ok-button"
variant="primary"
@click="restore"
>
<b-spinner
v-if="loading"
small
type="grow"
>
</b-spinner>
{{ restoreButtonText }}
<b-badge
v-if="selectedPursuits.length > 0"
variant="outline-primary"
>{{ selectedPursuits.length }}
</b-badge>
</b-button>
<b-button
:disabled="loading"
@click="cancelModal"
dusk="deleted-pursuit-restore-cancel-button"
>
Cancel
</b-button>
</div>
</div>
</template>