demo 原始链接:https://vux.li/demos/v2/#/component/sticky
\n下面的$t是Demo的i18n使用的翻译函数,一般情况下可以直接使用字符串。另外,下面代码隐藏了i18n标签部分的代码。
\n<template>\n <div>\n <br/>\n <br/>\n <div class=\"space-btn\" @click=\"spaceChange\">显示间隔</div>\n <div class=\"space\" v-if=\"showSpace\">间隔</div>\n <div style=\"height:44px;\">\n <sticky scroll-box=\"vux_view_box_body\" ref=\"sticky\" :offset=\"46\" :check-sticky-support=\"false\">\n <tab :line-width=\"1\">\n <tab-item selected>正在正映</tab-item>\n <tab-item>即将上映</tab-item>\n </tab>\n </sticky>\n </div>\n <p v-for=\"i in 100\">{{i}}<br></p>\n </div>\n</template>\n\n<script>\nimport { Tab, TabItem, Sticky } from 'vux'\n\nexport default {\n components: {\n Tab,\n TabItem,\n Sticky\n },\n data () {\n return {\n showSpace: false\n }\n },\n methods: {\n spaceChange () {\n this.showSpace = !this.showSpace\n this.$nextTick(() => {\n this.$refs.sticky.bindSticky()\n })\n }\n }\n}\n</script>\n<style scoped>\n .space-btn {\n padding: 5px 0;\n margin: 10px;\n text-align: center;\n border: 1px red solid;\n }\n\n .space {\n padding: 30px 0;\n margin: 10px;\n text-align: center;\n border: 1px green solid;\n }\n</style>\n\n
\n