Giter Club home page Giter Club logo

vue-stick's Introduction

vue-stick

A waterfall flow component based on vue.js

一款基于 vue.js 的瀑布流组件。

如何引入

您可以下载 dist 目录下的产出文件至您的项目中,用任何您希望使用的方式引入。 产出文件包含 umd 模块、ES 模块两个版本,您可以根据自己的项目自行选择。

也可以通过 npm 安装。

npm install -s vue-stick

引入 vue-stick 之后,您可以选择安装为 Vue 全局模块,也可以局部使用。

var Stick = require('vue-stick')
// 全局注册
Vue.use(Stick)

// 局部注册
new Vue({
	data: {},
	components: {
		Stick: Stick.component
	}
})

如何使用

template

<Stick
	:list="list"
	@onScrollEnd="loadMore"
	>
  <template slot-scope="scope">
		<div class="card">
      <img v-if="scope.data.cover" :src="scope.data.cover"/>
      <h2>{{scope.data.title}}</h2>
      <p>{{scope.data.intro}}</p>
    </div>
  </template>
</Stick>

vue

{
  data: {
    list: [
      {
        "cover": "http://static.bh-lay.com/.../share.jpg",
        "intro": "2018 年对于我来说是非...",
        "title": "剧中人的2018年终总结"
      },
      {
        "cover": "http://static.bh-lay.com/.../cover.jpg",
        "intro": "再次见到合肥,在历经五年的沪漂之后...",
        "title": "再见 · 合肥"
      }
    ]
  },
	methods: {
    loadMore: function () {
      this.list.push({
        "cover": "http://static.bh-lay.com/...yout.png",
        "intro": "今天的分享主要围绕 可视化布局模块的一些...",
        "title": "added by scroll 可视化布局模块开发分享"
      })
    }
  }
}

参数

参数 类型 必填 默认值 解释
list Array 必填 [] 瀑布流数据列表
columnWidth Number - 280 卡片宽度
columnSpacing Number - 10 卡片间距
loadTriggerDistance Number - 1000 滚动加载距离边界值
animationClass String - 'stick-fade-in' 卡片插入时的动画class

说明:

因瀑布流的特殊性,请尽可能保证卡片內布局的稳定性。为响应可能的高度变化,本组件会延迟到第一张图片加载完成后再渲染。

该项目由原生瀑布流组件 stick 演绎而成。

vue-stick's People

Contributors

bh-lay avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vue-stick's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.