改变风格 Quasar 元素

时间:2021-04-03 14:37:49

标签: css vue.js select quasar

我的应用程序 (https://coronavirus-statistics-app.herokuapp.com/timeline) 使用 Quasar 框架。 在“时间轴”函数中,我使用 q-select 元素来选择一个国家。我固定了 q-select 元素的宽度,但我没有成功地固定下面列表的宽度(如果国家名称是否长,宽度会改变,不是很人性化)。

enter image description here

如何固定q-select元素下方列表的宽度?

我的代码:

<q-select outlined v-model="country" :options="data" option-label="name" label="Select a Country" class="input" />

<style scoped lang="scss">
  .bg-color {
    background-color: #e7e8d1;
  }
  
  .input {
    width: 200px;
    margin: 10px 0;
  }
</style>

1 个答案:

答案 0 :(得分:1)

为下拉列表生成的 HTML 与用于选择它的输入是分开的。您只需要为 q-menu 指定宽度。

.q-menu { 
  width: 200px;
}

您还可以在代码中应用一个新类,以便并非所有菜单都是 200 像素。

输出:

enter image description here