[new feature] add sticky component (#3888)

This commit is contained in:
neverland
2019-07-18 17:48:18 +08:00
committed by GitHub
parent e1021e70ba
commit b273c89b3a
23 changed files with 651 additions and 124 deletions

76
src/sticky/demo/index.vue Normal file
View File

@@ -0,0 +1,76 @@
<template>
<demo-section>
<demo-block :title="$t('basicUsage')">
<van-sticky>
<van-button
type="primary"
style="margin-left: 15px;"
>
{{ $t('basicUsage') }}
</van-button>
</van-sticky>
</demo-block>
<demo-block :title="$t('offsetTop')">
<van-sticky :offset-top="50">
<van-button
type="info"
style="margin-left: 115px;"
>
{{ $t('offsetTop') }}
</van-button>
</van-sticky>
</demo-block>
<demo-block :title="$t('setContainer')">
<div
ref="container"
style="height: 150px; background-color: #fff;"
>
<van-sticky :container="container">
<van-button
type="warning"
style="margin-left: 215px;"
>
{{ $t('setContainer') }}
</van-button>
</van-sticky>
</div>
</demo-block>
</demo-section>
</template>
<script>
export default {
i18n: {
'zh-CN': {
offsetTop: '吸顶距离',
setContainer: '指定容器'
},
'en-US': {
offsetTop: 'Offset Top',
setContainer: 'Set Container'
}
},
data() {
return {
container: null
};
},
mounted() {
this.container = this.$refs.container;
}
};
</script>
<style lang="less">
.demo-sticky {
height: 200vh;
.van-button {
margin-left: 15px;
}
}
</style>