123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- "use strict";
- const common_vendor = require("../../../common/vendor.js");
- const sheep_index = require("../../index.js");
- require("../../api/index.js");
- require("../../api/distri/score.js");
- require("../../request/index.js");
- require("../../config/index.js");
- require("../../store/index.js");
- require("../../store/app.js");
- require("../../api/promotion/diy.js");
- require("../../platform/index.js");
- require("../../platform/provider/wechat/index.js");
- require("../../platform/provider/wechat/miniProgram.js");
- require("../../api/member/auth.js");
- require("../../api/member/social.js");
- require("../../api/member/user.js");
- require("../../platform/provider/apple/index.js");
- require("../../platform/share.js");
- require("../../router/index.js");
- require("../../hooks/useModal.js");
- require("../../helper/index.js");
- require("../../helper/test.js");
- require("../../helper/digit.js");
- require("../../api/member/signin.js");
- require("../../helper/throttle.js");
- require("../../url/index.js");
- require("../../platform/pay.js");
- require("../../api/pay/order.js");
- require("../../store/user.js");
- require("../../store/cart.js");
- require("../../api/trade/cart.js");
- require("../../api/pay/wallet.js");
- require("../../api/trade/order.js");
- require("../../api/promotion/coupon.js");
- require("../../store/sys.js");
- require("../../store/modal.js");
- require("../../api/distri/share.js");
- require("../../api/distri/team.js");
- require("../../api/infra/file.js");
- require("../../api/member/address.js");
- require("../../api/member/point.js");
- require("../../api/migration/app.js");
- require("../../api/migration/chat.js");
- require("../../api/migration/index.js");
- require("../../api/migration/third.js");
- require("../../api/pay/channel.js");
- require("../../api/product/category.js");
- require("../../api/product/comment.js");
- require("../../api/product/favorite.js");
- require("../../api/product/history.js");
- require("../../api/product/spu.js");
- require("../../api/promotion/activity.js");
- require("../../api/promotion/article.js");
- require("../../api/promotion/bargain.js");
- require("../../api/promotion/combination.js");
- require("../../api/promotion/rewardActivity.js");
- require("../../api/promotion/seckill.js");
- require("../../api/system/area.js");
- require("../../api/system/voice.js");
- require("../../api/trade/afterSale.js");
- require("../../api/trade/brokerage.js");
- require("../../api/trade/config.js");
- require("../../api/trade/delivery.js");
- require("../../config/zIndex.js");
- const _sfc_main = {
- __name: "su-fixed",
- props: {
- noNav: {
- type: Boolean,
- default: false
- },
- bottom: {
- type: Boolean,
- default: false
- },
- bg: {
- type: String,
- default: ""
- },
- bgStyles: {
- type: Object,
- default() {
- }
- },
- val: {
- type: Number,
- default: 0
- },
- width: {
- type: [String, Number],
- default: 0
- },
- alway: {
- type: Boolean,
- default: true
- },
- opacity: {
- type: Boolean,
- default: false
- },
- index: {
- type: [Number, String],
- default: 0
- },
- placeholder: {
- type: [Boolean],
- default: false
- },
- sticky: {
- type: [Boolean],
- default: false
- },
- noFixed: {
- type: Boolean,
- default: false
- },
- ui: {
- type: String,
- default: ""
- },
- clickTo: {
- type: Boolean,
- default: false
- },
- //是否需要安全区
- isInset: {
- type: Boolean,
- default: true
- }
- },
- setup(__props) {
- const { safeAreaInsets } = sheep_index.sheep.$platform.device;
- const vm = common_vendor.getCurrentInstance();
- const uuid = sheep_index.sheep.$helper.guid();
- const sys_navBar = sheep_index.sheep.$platform.navbar;
- const state = common_vendor.reactive({
- content: {},
- fixed: true,
- scrollTop: 0,
- opacityVal: 0
- });
- const insetHeight = common_vendor.computed(() => {
- if (state.fixed && props.bottom) {
- if (props.isInset) {
- return props.val + "px";
- } else {
- return props.val + safeAreaInsets.bottom + "px";
- }
- } else {
- return "auto";
- }
- });
- const props = __props;
- state.fixed = !common_vendor.unref(props.sticky);
- common_vendor.onPageScroll((e) => {
- let top = e.scrollTop;
- state.scrollTop = top;
- state.opacityVal = top > sheep_index.sheep.$platform.navbar ? 1 : top * 0.01;
- });
- common_vendor.onMounted(() => {
- common_vendor.nextTick$1(() => {
- computedQuery();
- });
- });
- const computedQuery = () => {
- common_vendor.index.createSelectorQuery().in(vm).select(`#fixed-${uuid}`).boundingClientRect((data) => {
- if (data != null) {
- state.content = data;
- if (common_vendor.unref(props.sticky)) {
- setFixed(state.scrollTop);
- }
- }
- }).exec();
- };
- const setFixed = (value) => {
- if (common_vendor.unref(props.bottom)) {
- state.fixed = value >= state.content.bottom - sheep_index.sheep.$platform.device.windowHeight + state.content.height + common_vendor.unref(props.val);
- } else {
- state.fixed = value >= state.content.top - (common_vendor.unref(props.noNav) ? common_vendor.unref(props.val) : common_vendor.unref(props.val) + sheep_index.sheep.$platform.navbar);
- }
- };
- const toTop = () => {
- if (props.hasToTop) {
- common_vendor.index.pageScrollTo({
- scrollTop: state.content.top,
- duration: 100
- });
- }
- };
- return (_ctx, _cache) => {
- return common_vendor.e({
- a: common_vendor.unref(safeAreaInsets).bottom && __props.bottom && __props.isInset
- }, common_vendor.unref(safeAreaInsets).bottom && __props.bottom && __props.isInset ? {
- b: common_vendor.s({
- height: common_vendor.unref(safeAreaInsets).bottom + "px"
- })
- } : {}, {
- c: common_vendor.o(toTop),
- d: common_vendor.s({
- zIndex: __props.index + common_vendor.unref(sheep_index.sheep).$zIndex.navbar
- }),
- e: __props.bottom
- }, __props.bottom ? {
- f: common_vendor.n(__props.bg)
- } : {}, {
- g: common_vendor.n(__props.ui),
- h: common_vendor.n(__props.bg),
- i: common_vendor.s({
- zIndex: __props.index + common_vendor.unref(sheep_index.sheep).$zIndex.navbar - 1
- }),
- j: common_vendor.s(__props.bgStyles),
- k: common_vendor.s(__props.opacity ? {
- opacity: state.opacityVal
- } : ""),
- l: `fixed-${common_vendor.unref(uuid)}`,
- m: common_vendor.n({
- fixed: state.fixed
- }),
- n: common_vendor.s({
- left: __props.sticky ? "auto" : "0px",
- top: state.fixed && !__props.bottom ? (__props.noNav ? __props.val : __props.val + common_vendor.unref(sys_navBar)) + "px" : "auto",
- bottom: insetHeight.value,
- zIndex: __props.index + common_vendor.unref(sheep_index.sheep).$zIndex.navbar
- }),
- o: common_vendor.s(!__props.alway ? {
- opacity: state.opacityVal
- } : ""),
- p: __props.sticky ? state.fixed : __props.placeholder && state.fixed
- }, (__props.sticky ? state.fixed : __props.placeholder && state.fixed) ? {
- q: common_vendor.s({
- height: state.content.height + "px",
- width: __props.width + "px"
- })
- } : {});
- };
- }
- };
- const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/zx/mall-front-app/sheep/ui/su-fixed/su-fixed.vue"]]);
- wx.createComponent(Component);
|