vue-router 示例_关于使用vue-recyclerview掌握大型列表的示例

vue-router 示例

vue-recyclerview (vue-recyclerview)

Mastering Large Lists with the vue-recyclerview.

使用vue-recyclerview掌握大型列表。

特征 (Feature)

DOM recyleing Multiple column Waterflow

DOM回收多柱水流

vue-recyclerview

安装 (Installation)

直接下载/ CDN (Direct Download / CDN)

https://unpkg.com/vue-recyclerview/dist/vue-recyclerview

https://unpkg.com/vue-recyclerview/dist/vue-recyclerview

unpkg.com provides NPM-based CDN links. The above link will always point to the latest release on NPM. You can also use a specific version/tag via URLs like https://unpkg.com/vue-recyclerview/dist/vue-recyclerview.js

unpkg.com提供基于NPM的CDN链接。 上面的链接将始终指向NPM的最新版本。 您还可以通过诸如https://unpkg.com/vue-recyclerview/dist/vue-recyclerview.js之类的 URL使用特定版本/标签。

Include vue-recyclerview after Vue and it will install itself automatically:

在Vue之后包含vue-recyclerview,它将自动安装自身:

<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/vue-recyclerview/dist/vue-recyclerview.js"></script>

NPM (NPM)

$ npm install vue-recyclerview

When used with a module system, you must explicitly install the vue-recyclerview via Vue.use():

与模块系统一起使用时,必须通过Vue.use()显式安装vue-recyclerview

import Vue from 'vue'
import VueRecyclerviewNew from 'vue-recyclerview'

Vue.use(VueRecyclerviewNew)

You don't need to do this when using global script tags.

使用全局脚本标记时,您不需要这样做。

开发构建 (Dev Build)

You will have to clone directly from GitHub and build vue-recyclerview yourself if you want to use the latest dev build.

如果要使用最新的开发版本,则必须直接从GitHub克隆并vue-recyclerview构建vue-recyclerview

$ git clone[email protected]:hilongjw/vue-recyclerview.git node_modules/vue-recyclerview
$ cd node_modules/vue-recyclerview
$ npm install
$ npm run build

入门 (Getting Started)

We will be using ES2015 in the code samples in the guide.

我们将在指南的代码示例中使用ES2015

main.js (main.js)

// If using a module system (e.g. via vue-cli), import Vue and RecyclerView and then call Vue.use(RecyclerView).
// import Vue from 'vue'
// import RecyclerView from 'vue-recyclerview'
// import App from './App.vue'
// Vue.use(RecyclerView)

// Now the app has started!
new Vue({
  render: h => h(App)
}).$mount('#app')

应用程序 (App.vue)

<template>
  <div id="app">
    <RecyclerView
      :prerender="30"
      style="height: calc(100vh - 50px)"
      :fetch="MiFetch" 
      :item="MiItem" 
      :tombstone="MiTomstone"
    ></RecyclerView>
  </div>
</template>

<script>
import MiItem from './MiItem.vue'
import MiTomstone from './MiTombstone.vue'
import MiFetch from './mi-fetch'

export default {
  name: 'app',
  data () {
    return {
      MiFetch,
      MiItem,
      MiTomstone
    }
  }
}
</script>

道具选项 (Props Options)

keydescriptiondefualttype/options
fetchData fetching function
listList data of RecyclerView[]
prerenderNumber of items to instantiate beyond current view in the opposite direction.20Number
remainNumber of items to instantiate beyond current view in the opposite direction.10Number
columnSpecifies how many columns the listings should be displayed in1Number
itemThe Vue component of RecyclerView's itemVue component
tombstoneThe Vue component of RecyclerView's tombstoneVue component
loadingThe loading component behind the RecyclerView pull-to-refreshbuilt-in loadingVue component
描述 脱脂 类型/选项
fetch 数据获取功能
list 列出RecyclerView的数据 []
prerender 以相反的方向实例化超出当前视图的项目数。 20
remain 以相反的方向实例化超出当前视图的项目数。 10
column 指定列表应显示在多少列中 1个
item RecyclerView项目的Vue组件 Vue组件
tombstone RecyclerView的墓碑的Vue组件 Vue组件
loading RecyclerView下拉刷新后的加载组件 内置加载 Vue组件
  • fetch:Function

    获取:功能

function fetch (limit:Number, skip:Number) {
  return Promise.resolve({
    list: list // Array,
    count: count // Number
  })
}
  • list

    清单

[
// item
{
  vm: vm, // <Vue Instance>
  data: {
    name: 'test'
  },
  node: null,
  height: 100,
  width: 100,
  top: 0,
}, 
// tombstone
{
  vm: null
  data: null,
  node: null,
  height: 100,
  width: 100,
  top: 0,
}]

实例方法 (Instance Method)

  • scrollToIndex

    scrollToIndex

this.$refs.RecyclerView.scrollToIndex(100)

翻译自: https://vuejsexamples.com/a-example-about-mastering-large-lists-with-the-vue-recyclerview/

vue-router 示例

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值