UNPKG

@gyenno/nutui-taro

Version:

京东风格的轻量级移动端 Vue2、Vue3 组件库(支持小程序开发)

61 lines (60 loc) 1.28 kB
import { ref, computed, h } from "vue"; import { c as createComponent } from "./component-25dcca32.js"; import "../locale/lang"; const { componentName, create } = createComponent("sticky"); const _sfc_main = create({ props: { top: { type: [Number, String], default: 0 }, zIndex: { type: [Number, String], default: 2e3 }, parentHeight: { type: [Number], default: 667 } }, emits: ["change", "scroll"], setup(props, { emit, slots }) { const root = ref(); const rootStyle = computed(() => { return { height: `${props.parentHeight}px` }; }); const stickyStyle = computed(() => { const style = { top: `${props.top}px`, zIndex: +props.zIndex }; return style; }); const renderFixed = () => { var _a; return h( "view", { style: stickyStyle.value, class: `${componentName} nut-sticky--stickyed` }, (_a = slots.default) == null ? void 0 : _a.call(slots) ); }; return () => { return h( "view", { style: rootStyle.value, ref: root }, [renderFixed()] ); }; } }); export { _sfc_main as default };