init
This commit is contained in:
1
unpackage/dist/build/mp-weixin/uni_modules/nutui-uni/components/sticky/sticky.js
vendored
Normal file
1
unpackage/dist/build/mp-weixin/uni_modules/nutui-uni/components/sticky/sticky.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";const e=require("../../../../common/vendor.js"),t=require("../_constants/prefix.js"),o=require("../_hooks/useRect.js"),n=require("../_utils/common.js"),u=require("../_utils/env.js"),s=require("../_utils/pxCheck.js"),a=require("../_utils/style.js"),i=require("../_utils/props.js"),r={...i.commonProps,offsetTop:i.makeNumericProp(0),zIndex:{type:[Number,String],default:2e3},customNavHeight:i.makeNumericProp(u.isH5?44:0),disabled:Boolean,bgColor:i.makeStringProp("transparent")},l=`${t.PREFIX}-sticky`,c=e.defineComponent({name:l,options:{virtualHost:!0,addGlobalClass:!0,styleIsolation:"shared"}}),d=e.defineComponent({...c,props:r,setup(t){const u=t,i=e.getCurrentInstance(),r=`${l}-${n.getRandomId()}`,c=e.ref(!1),d=e.ref(0),p=e.ref("auto"),v=e.ref("auto"),m=e.ref(!1),f=e.computed((()=>a.getMainClass(u,l))),x=e.computed((()=>Number(a.getPx(u.offsetTop))+Number(a.getPx(u.customNavHeight)))),g=e.computed((()=>{const e={};return u.disabled?e.position="static":c.value?(e.position="sticky",e.top=s.pxCheck(x.value),e.zIndex=u.zIndex):m.value&&"auto"!==v.value?e.height=`${v.value}px`:e.height="auto",e.backgroundColor=u.bgColor,a.getMainStyle(u,e)})),h=e.computed((()=>{const e={};return c.value||(e.position=m.value?"fixed":"static",e.top=`${x.value}px`,e.left=`${d.value}px`,e.width="auto"===p.value?"auto":`${p.value}px`,e.zIndex=u.zIndex),e}));const b=e.shallowRef(null);function y(){null!=b.value&&(b.value.disconnect(),b.value=null)}function C(){y();const t=e.index.createIntersectionObserver({thresholds:[.95,.98,1]});t.relativeToViewport({top:-x.value}),t.observe(`#${r}`,(e=>{var t;t=e.boundingClientRect.top,m.value=t<=x.value})),b.value=t}async function I(){const t=e.index.getSystemInfoSync();"android"===t.osName&&Number.parseInt(t.osVersion)>8&&(c.value=!0),c.value=await new Promise((t=>{e.index.createSelectorQuery().in(i).select(`.${l}`).fields({computedStyle:["position"]},(()=>{})).exec((e=>{t("sticky"===e[0].position)}))})),"ios"===t.osName&&(c.value=!0)}function k(){I(),c.value||u.disabled||o.useRect(r,i).then((t=>{d.value=t.left,p.value=String(t.width),v.value=String(t.height),e.nextTick$1((()=>{C()}))}))}return e.onMounted((()=>{k()})),e.onUnmounted((()=>{y()})),(t,o)=>({a:e.s(h.value),b:r,c:e.n(f.value),d:e.s(g.value)})}});wx.createComponent(d);
|
||||
4
unpackage/dist/build/mp-weixin/uni_modules/nutui-uni/components/sticky/sticky.json
vendored
Normal file
4
unpackage/dist/build/mp-weixin/uni_modules/nutui-uni/components/sticky/sticky.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
unpackage/dist/build/mp-weixin/uni_modules/nutui-uni/components/sticky/sticky.wxml
vendored
Normal file
1
unpackage/dist/build/mp-weixin/uni_modules/nutui-uni/components/sticky/sticky.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view id="{{b}}" class="{{c}}" style="{{d}}"><view class="nut-sticky__content" style="{{a}}"><slot/></view></view>
|
||||
1
unpackage/dist/build/mp-weixin/uni_modules/nutui-uni/components/sticky/sticky.wxss
vendored
Normal file
1
unpackage/dist/build/mp-weixin/uni_modules/nutui-uni/components/sticky/sticky.wxss
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.nut-sticky{position:-webkit-sticky;position:sticky}
|
||||
Reference in New Issue
Block a user