1.0.1 • Published 7 years ago
vue-simple-sticky v1.0.1
置顶sticky
sticky options说明
- top :
Number String
, 可选,可识别'','px','rem','em'单位,无单位默认px - cancelSticky :
Boolean
, 可选,默认false,为 true 时取消Sticky组件功能。
事件
插槽
- 默认插槽 把需要置顶的元素插入组件中
使用
<template>
<div>
<sticky>
<div style="width:100%;height:40px;background-color:gray"></div>
</sticky>
<div style="width:100%;height:100px;background-color:blue"></div>
<sticky top='40px'>
<div style="width:100%;height:40px;background-color:green"></div>
</sticky>
<div style="width:100%;height:1000px;background-color:red"></div>
</div>
</template>
<script>
import sticky from '../src/index';
export default {
name: 'demo',
components: {
'sticky': sticky,
},
};
</script>
Build Setup
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# Packed File
npm run build