css - vue onsenui v-ons-card 自动添加滚动条的方法

标签 css vuejs2 scrollbar onsen-ui2

OnsenUI2 ons-card(尤其是 Vue2.js v-ons-card)的文档如果我添加,会自动在内容旁边显示一个滚动条许多 v-ons-list-item 元素。

参见此处:https://onsen.io/v2/api/vue/v-ons-card.html

这是我使用额外列表项修改教程并添加滚动条时发生的情况的屏幕截图:

spilling over card content with scrollbar

但是当我在我的代码中手动执行时,我没有滚动条。

   <v-ons-card>
  <div class="title">
    My title here
  </div>
  <div class="content">
    <v-ons-list>
      <!-- <v-ons-list-header>row 1</v-ons-list-header> -->
      <v-ons-list-item>Row 1</v-ons-list-item>
      <v-ons-list-item>Row 2</v-ons-list-item>
      <v-ons-list-item>Row 3</v-ons-list-item>
      <v-ons-list-item>Row 4</v-ons-list-item>
      <v-ons-list-item>Row 5</v-ons-list-item>
      <v-ons-list-item>Row 6</v-ons-list-item>
      <v-ons-list-item>Row 7</v-ons-list-item>
      <v-ons-list-item>Row 8</v-ons-list-item>
      <v-ons-list-item>Row 9</v-ons-list-item>
      <v-ons-list-item>Row 10</v-ons-list-item>
      <v-ons-list-item>Row 11</v-ons-list-item>
      <v-ons-list-item>Row 12</v-ons-list-item>
      <v-ons-list-item>Row 13</v-ons-list-item>
      <v-ons-list-item>Row 14</v-ons-list-item>
      <v-ons-list-item>Row 15</v-ons-list-item>
      <v-ons-list-item>Row 16</v-ons-list-item>
    </v-ons-list>
  </div>
</v-ons-card>

它是如何实现的?

该示例未显示完整的 css,并且在 chrome devtools 中我无法打开和显示演示应用程序。 :-(

style="overflow: auto" 添加到包装卡片内部的 div、卡片内容或卡片本身不会执行任何操作。

最佳答案

该教程中没有额外的 CSS。图片中的滚动条位于页面内容上,而不是卡片元素上。只需设置 heightoverflow: auto 即可获得卡片滚动条。

关于css - vue onsenui v-ons-card 自动添加滚动条的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46785394/

相关文章:

php - 基于动态 PHP 变量的第 n 个子配方

javascript - 悬停事件上的图像

html - 使用标题标签将网站居中

javascript - package.json 中包含的代理不起作用

module - 无模板的组件

php - 如何使用 Passport 刷新 API 调用的 laravel_token

javascript - malihu-custom-scrollbar-plugin 的主题不适合我

java - 如何使用 CSS 在 JavaFX2 中设置表格单元格的样式(不删除悬停/选择等)

javascript - 仅通过 JS 禁用滚动

android - 如何更改android中默认滚动大小的宽度?