Laravel Nova Metric 卡片位置

Laravel Nova Metric card position

是否可以将卡片移动到包含详细信息的方块下方?

虽然 Laravel Nova 不允许这样做,但您可以使用自定义香草 JavaScript 来剪切和粘贴它。这有点 hacky 但它有效 ‍♂️

这些都在 artisan nova:card yourname/customcard 命令创建的 Card.vue 中。

给卡片一个 id 以便我们稍后找到它:

 <card class="flex flex-col justify-center" id="custom-card">

然后再找:

let customCard = document.querySelector('#custom-card');

该资源的详细信息列表有一个带有自定义 dusk 元素的 div,值设置为 resourcename-detail-component,其中 resourcename 例如user。您需要找到该元素,然后将卡片片段附加到它:

let anotherComponent = document.querySelector('div[dusk=resourcename-detail-component]');
anotherComponent.appendChild(customCard);

我在这里写了这个:Laravel Nova: Move cards in Resource Detail View