无法设置 buefy 模态宽度

Vip*_*rma 1 javascript vue.js bulma buefy

我将 vuejs 与 bulma 和 buefy 一起使用。我正在使用 buefy 模态并尝试使用其“width”属性设置模态宽度。我尝试在 html 中指定它并使用 javascript 打开模式。

this.$modal.open({
  parent: this,
  component: dummyComponent,
  width: 720
}) 
Run Code Online (Sandbox Code Playgroud)

有人可以帮我吗?

小智 5

您还需要在组件中设置 style="width: auto" ,然后考虑打开模式时设置的宽度。

然后js部分就保留了

this.$modal.open({
  parent: this,
  component: dummyComponent,
  width: 720
}) 
Run Code Online (Sandbox Code Playgroud)

你的组件将是

<template>
  <div class="modal-card" style="width: auto">
   <!-- Content comes here... -->
  </div>
</template>
Run Code Online (Sandbox Code Playgroud)

buefy 文档中的示例也包含它,但它们没有明确说明您需要它来设置宽度。