| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <template>
- <div class="demo full">
- <h2>纵向</h2>
- <nut-cell>
- <div class="vertical">
- <nut-pullrefresh
- @refresh="refresh"
- @down-refresh="downRefresh"
- :useWindow="false"
- containerId="pull"
- >
- <div class="content" id="pull">
- <div class="main">
- <div
- class="pull-data"
- v-for="item in [1, 2, 3, 4, 5, 6, 7, 8, 9]"
- :key="item"
- >我是测试数据 {{ item }}</div
- >
- </div>
- </div>
- </nut-pullrefresh>
- </div>
- </nut-cell>
- <h2>横向</h2>
- <nut-cell>
- <div class="horizontal">
- <nut-pullrefresh
- @refresh="refresh"
- @down-refresh="downRefresh"
- :useWindow="false"
- containerId="pullH"
- direction="horizontal"
- >
- <div class="contentH" id="pullH">
- <div class="mainH">
- <div
- class="pull-data"
- v-for="item in [1, 2, 3, 4, 5, 6, 7, 8, 9]"
- :key="item"
- >我是测试数据 {{ item }}</div
- >
- </div>
- </div>
- </nut-pullrefresh>
- </div>
- </nut-cell>
- </div>
- </template>
- <script lang="ts">
- import { createComponent } from '../../utils/create';
- const { createDemo } = createComponent('pullrefresh');
- export default createDemo({
- props: {},
- setup() {
- const refresh = (done) => {
- console.log('上拉加载');
- setTimeout(() => {
- done();
- }, 1000);
- };
- const downRefresh = (done) => {
- console.log('下拉刷新');
- setTimeout(() => {
- done();
- }, 1000);
- };
- return { refresh, downRefresh };
- }
- });
- </script>
- <style lang="scss" scoped>
- .vertical {
- height: 300px;
- overflow: hidden;
- width: 100%;
- }
- .content {
- height: 100%;
- overflow: auto;
- }
- .horizontal {
- width: 100%;
- }
- .contentH {
- height: 100px;
- overflow: auto;
- .mainH {
- display: flex;
- height: 100%;
- .pull-data {
- flex-shrink: 0;
- display: flex;
- align-items: center;
- height: 90%;
- width: 120px;
- justify-content: center;
- padding: 0;
- margin: 2px 10px 0 0;
- background: white;
- border-radius: 7px;
- box-shadow: 0px 1px 7px 0px #edeef1;
- line-height: 19px;
- font-size: 13px;
- color: #666666;
- }
- }
- }
- .content {
- .main {
- .pull-data {
- margin: 15px auto 20px;
- padding-left: 16px;
- display: flex;
- align-items: center;
- width: 100%;
- height: 46px;
- background: rgba(255, 255, 255, 1);
- border-radius: 7px;
- box-shadow: 0px 1px 7px 0px rgba(237, 238, 241, 1);
- line-height: 19px;
- font-size: 13px;
- color: rgba(102, 102, 102, 1);
- &:first-child {
- margin-top: 0 !important;
- }
- &:last-child {
- margin-bottom: 0 !important;
- }
- }
- }
- }
- </style>
|