1 line
7.7 KiB
Plaintext
1 line
7.7 KiB
Plaintext
{"version":3,"file":"s-custom-navbar.js","sources":["../../../../../../src/sheep/components/s-custom-navbar/s-custom-navbar.vue","../../../../../../uniComponent:/RDovQXBwL1dvcmsvYWRkci9hY2RyLXVpL3NyYy9zaGVlcC9jb21wb25lbnRzL3MtY3VzdG9tLW5hdmJhci9zLWN1c3RvbS1uYXZiYXIudnVl"],"sourcesContent":["<!-- 顶部导航栏 -->\r\n<template>\r\n <navbar\r\n :alway=\"isAlways\"\r\n :back=\"false\"\r\n bg=\"\"\r\n :placeholder=\"isPlaceholder\"\r\n :bgStyles=\"bgStyles\"\r\n :opacity=\"isOpacity\"\r\n :sticky=\"sticky\"\r\n >\r\n <template #item>\r\n <view class=\"nav-box\">\r\n <view class=\"nav-icon\" v-if=\"showLeftButton\">\r\n <view class=\"icon-box ss-flex\" :class=\"{ 'inner-icon-box': data.styleType === 'inner' }\">\r\n <view class=\"icon-button icon-button-left ss-flex ss-row-center\" @tap=\"onClickLeft\">\r\n <text class=\"sicon-back\" v-if=\"hasHistory\" />\r\n <text class=\"sicon-home\" v-else />\r\n </view>\r\n <view class=\"line\"></view>\r\n <view class=\"icon-button icon-button-right ss-flex ss-row-center\" @tap=\"onClickRight\">\r\n <text class=\"sicon-more\" />\r\n </view>\r\n </view>\r\n </view>\r\n <view\r\n class=\"nav-item\"\r\n v-for=\"(item, index) in navList\"\r\n :key=\"index\"\r\n :style=\"[parseImgStyle(item)]\"\r\n :class=\"[{ 'ss-flex ss-col-center ss-row-center': item.type !== 'search' }]\"\r\n >\r\n <navbar-item :data=\"item\" :width=\"parseImgStyle(item).width\" />\r\n </view>\r\n </view>\r\n </template>\r\n </navbar>\r\n</template>\r\n\r\n<script setup>\r\n/**\r\n * 装修组件 - 自定义标题栏\r\n *\r\n *\r\n * @property {Number | String} alwaysShow = [0,1]\t\t\t - 是否常驻\r\n * @property {Number | String} styleType = [inner]\t\t\t \t- 是否沉浸式\r\n * @property {String | Number} type \t\t \t\t\t\t\t- 标题背景模式\r\n * @property {String} color \t\t \t\t\t\t\t\t\t- 页面背景色\r\n * @property {String} src \t\t \t\t\t\t\t\t\t\t- 页面背景图片\r\n */\r\nimport { computed, unref } from 'vue'\r\nimport sheep from '@/sheep'\r\nimport Navbar from './components/navbar.vue'\r\nimport NavbarItem from './components/navbar-item.vue'\r\nimport { showMenuTools } from '@/sheep/hooks/useModal'\r\n\r\nconst props = defineProps({\r\n data: {\r\n type: Object,\r\n default: () => ({}),\r\n },\r\n showLeftButton: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n})\r\nconst hasHistory = sheep.$router.hasHistory()\r\nconst sticky = computed(() => {\r\n if (props.data.styleType === 'inner') {\r\n if (props.data.alwaysShow) {\r\n return false\r\n }\r\n }\r\n if (props.data.styleType === 'normal') {\r\n return false\r\n }\r\n})\r\nconst navList = computed(() => {\r\n // #ifdef MP\r\n return props.data.mapCells || []\r\n // #endif\r\n return props.data.otherCells || []\r\n})\r\n// 页面宽度\r\nconst windowWidth = sheep.$platform.device.windowWidth\r\n// 单元格宽度\r\nconst cell = computed(() => {\r\n if (unref(navList).length) {\r\n // 默认宽度为8个格子,微信公众号右上角有胶囊按钮所以是6个格子\r\n let cell = (windowWidth - 90) / 8\r\n // #ifdef MP\r\n cell = (windowWidth - 80 - unref(sheep.$platform.capsule).width) / 6\r\n // #endif\r\n return cell\r\n }\r\n})\r\n// 解析位置\r\nconst parseImgStyle = (item) => {\r\n const obj = {\r\n width: item.width * cell.value + (item.width - 1) * 10 + 'px',\r\n left: item.left * cell.value + (item.left + 1) * 10 + 'px',\r\n 'border-radius': item.borderRadius + 'px',\r\n }\r\n return obj\r\n}\r\nconst isAlways = computed(() =>\r\n props.data.styleType === 'inner' ? Boolean(props.data.alwaysShow) : true,\r\n)\r\nconst isOpacity = computed(() =>\r\n props.data.styleType === 'normal'\r\n ? false\r\n : props.showLeftButton\r\n ? false\r\n : props.data.styleType === 'inner',\r\n)\r\nconst isPlaceholder = computed(() => props.data.styleType === 'normal')\r\nconst bgStyles = computed(() => {\r\n return {\r\n background:\r\n props.data.bgType === 'img' && props.data.bgImg\r\n ? `url(${sheep.$url.cdn(props.data.bgImg)}) no-repeat top center / 100% 100%`\r\n : props.data.bgColor,\r\n }\r\n})\r\n// 左侧按钮:返回上一页或首页\r\nfunction onClickLeft() {\r\n if (hasHistory) {\r\n sheep.$router.back()\r\n } else {\r\n sheep.$router.go('/modules/mall/index/index')\r\n }\r\n}\r\n// 右侧按钮:打开快捷菜单\r\nfunction onClickRight() {\r\n showMenuTools()\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n \r\n.nav-box {\r\n position: relative;\r\n width: 750rpx;\r\n height: 100%;\r\n\r\n .nav-item {\r\n position: absolute;\r\n top: 50%;\r\n transform: translateY(-50%);\r\n }\r\n .nav-icon {\r\n position: absolute;\r\n top: 50%;\r\n left: 20rpx;\r\n transform: translateY(-50%);\r\n .inner-icon-box {\r\n background: none !important;\r\n border: 1px solid rgba(#fff, 0.4);\r\n }\r\n .icon-box {\r\n width: 134rpx;\r\n height: 56rpx;\r\n margin-left: 8rpx;\r\n background: #ffffff;\r\n border-radius: 30rpx;\r\n box-shadow:\r\n 0px 0px 4rpx rgba(51, 51, 51, 0.08),\r\n 0px 4rpx 6rpx 2rpx rgba(102, 102, 102, 0.12);\r\n .line {\r\n width: 2rpx;\r\n height: 24rpx;\r\n background: #e5e5e7;\r\n }\r\n .sicon-back {\r\n font-size: 32rpx;\r\n }\r\n .sicon-home {\r\n font-size: 32rpx;\r\n }\r\n .sicon-more {\r\n font-size: 32rpx;\r\n }\r\n .icon-button {\r\n width: 67rpx;\r\n height: 56rpx;\r\n &-left:hover {\r\n background: rgba(0, 0, 0, 0.16);\r\n border-radius: 30rpx 0px 0px 30rpx;\r\n }\r\n &-right:hover {\r\n background: rgba(0, 0, 0, 0.16);\r\n border-radius: 0px 30rpx 30rpx 0px;\r\n }\r\n }\r\n }\r\n }\r\n}\r\n</style>\r\n","import Component from 'D:/App/Work/addr/acdr-ui/src/sheep/components/s-custom-navbar/s-custom-navbar.vue'\nwx.createComponent(Component)"],"names":["sheep","computed","unref","cell","showMenuTools"],"mappings":";;;;;;;AAoDA,MAAM,SAAS,MAAW;AAC1B,MAAM,aAAa,MAAW;;;;;;;;;;;;;;AAG9B,UAAM,QAAQ;AAUd,UAAM,aAAaA,YAAAA,MAAM,QAAQ,WAAY;AAC7C,UAAM,SAASC,cAAQ,SAAC,MAAM;AAC5B,UAAI,MAAM,KAAK,cAAc,SAAS;AACpC,YAAI,MAAM,KAAK,YAAY;AACzB,iBAAO;AAAA,QACR;AAAA,MACF;AACD,UAAI,MAAM,KAAK,cAAc,UAAU;AACrC,eAAO;AAAA,MACR;AAAA,IACH,CAAC;AACD,UAAM,UAAUA,cAAQ,SAAC,MAAM;AAE7B,aAAO,MAAM,KAAK,YAAY,CAAE;AAAA,IAGlC,CAAC;AAED,UAAM,cAAcD,YAAK,MAAC,UAAU,OAAO;AAE3C,UAAM,OAAOC,cAAQ,SAAC,MAAM;AAC1B,UAAIC,cAAK,MAAC,OAAO,EAAE,QAAQ;AAEzB,YAAIC,SAAQ,cAAc,MAAM;AAEhC,QAAAA,SAAQ,cAAc,KAAKD,cAAK,MAACF,YAAK,MAAC,UAAU,OAAO,EAAE,SAAS;AAEnE,eAAOG;AAAA,MACR;AAAA,IACH,CAAC;AAED,UAAM,gBAAgB,CAAC,SAAS;AAC9B,YAAM,MAAM;AAAA,QACV,OAAO,KAAK,QAAQ,KAAK,SAAS,KAAK,QAAQ,KAAK,KAAK;AAAA,QACzD,MAAM,KAAK,OAAO,KAAK,SAAS,KAAK,OAAO,KAAK,KAAK;AAAA,QACtD,iBAAiB,KAAK,eAAe;AAAA,MACtC;AACD,aAAO;AAAA,IACT;AACA,UAAM,WAAWF,cAAAA;AAAAA,MAAS,MACxB,MAAM,KAAK,cAAc,UAAU,QAAQ,MAAM,KAAK,UAAU,IAAI;AAAA,IACtE;AACA,UAAM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