0

The documentation of the OnsenUI2 ons-card (and in particular for Vue2.js v-ons-card) automatically shows a scrollbar next to the content if I add many v-ons-list-item elements.

See here: https://onsen.io/v2/api/vue/v-ons-card.html

Here's a screenshot of what happens when I modify the tutorial with extra list items, and the scrollbar added:

使用滚动条溢出卡片内容

But then when I do it manually in my code I get no 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 不会做任何事情。

4

1 回答 1

0

该教程中没有额外的 CSS。图片中的滚动条位于页面内容上,而不是卡片元素上。只需设置一个heightand overflow: auto,你就会得到你的卡片滚动条。

于 2017-10-23T01:25:31.770 回答