123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const common_assets = require("../../common/assets.js");
- const _sfc_main = {
- data() {
- return {
- logoImage: common_assets._imports_0,
- opacity: 0,
- scrollTop: 0,
- statusBarHeight: 0,
- // 状态按钮高度
- myback: {
- show: true
- },
- // top样式
- topStyle: {}
- };
- },
- props: {
- // 标题内容
- title: String,
- // 标题颜色
- titleColor: {
- type: String,
- default: "#000000"
- },
- // 返回按钮相关配置
- back: {
- type: Object,
- default: function() {
- return {
- // 是否显示返回按钮,默认显示
- show: true,
- logoShow: false
- // 返回按钮的图片地址
- // imgUrl: require('../../static/images/ico_back.png')
- };
- }
- },
- // 开启背景图片,未开启,使用背景颜色,开启backgroundImage为必填项
- backgroundImageShow: {
- type: Boolean,
- default: false
- },
- // 背景颜色,支持渐变色,如:linear-gradient(to top right, #CDDC39, #8BC34A, #FFEB3B);
- backgroundColor: {
- type: String,
- default: "linear-gradient(to top right, #CDDC39, #8BC34A, #FFEB3B)"
- },
- // 背景图片地址,使用前需配置backgroundImageShow为true。
- backgroundImage: String,
- // 是否保存顶部栏高度
- hideHeight: {
- type: Boolean,
- default: true
- },
- // 高度(除状态栏)
- topHeight: {
- type: Number,
- default: 80
- }
- },
- mounted() {
- this.init();
- },
- methods: {
- goBack() {
- const data = getCurrentPages();
- if (data.length > 1) {
- common_vendor.index.navigateBack();
- } else {
- common_vendor.index.switchTab({
- url: `/pages/index/index`
- });
- }
- },
- init() {
- this.statusBarHeight = this.getSysInfo().statusBarHeight;
- for (let key in this.back) {
- this.myback[key] = this.back[key];
- }
- },
- getSysInfo() {
- return common_vendor.index.getSystemInfoSync();
- },
- // 转接到达顶部距离参数
- scrollScroll(event) {
- this.scrollTop = event;
- if (event < 200) {
- this.opacity = event / 100 / 2;
- } else {
- this.opacity = 1;
- }
- }
- }
- };
- if (!Array) {
- const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
- _easycom_u_icon2();
- }
- const _easycom_u_icon = () => "../../uni_modules/uview-plus/components/u-icon/u-icon.js";
- if (!Math) {
- _easycom_u_icon();
- }
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return common_vendor.e({
- a: common_vendor.s("height: " + $data.statusBarHeight + "px"),
- b: common_vendor.s("height: " + $props.topHeight + "rpx"),
- c: !$props.backgroundImageShow ? $props.backgroundColor : "url(" + $props.backgroundImage + ") no-repeat;",
- d: $data.opacity,
- e: common_vendor.s("height: " + $data.statusBarHeight + "px"),
- f: $data.myback.show
- }, $data.myback.show ? {
- g: common_vendor.p({
- size: "20",
- name: "arrow-left"
- }),
- h: common_vendor.o((...args) => $options.goBack && $options.goBack(...args))
- } : {}, {
- i: $data.myback.logoShow
- }, $data.myback.logoShow ? {
- j: $data.logoImage,
- k: common_vendor.o((...args) => $options.goBack && $options.goBack(...args))
- } : {}, {
- l: common_vendor.t($props.title),
- m: $props.titleColor,
- n: common_vendor.s("height:" + $props.topHeight + "rpx"),
- o: common_vendor.s("height: calc(" + $data.statusBarHeight + "px + " + $props.topHeight + "rpx)")
- });
- }
- const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-10729898"]]);
- wx.createComponent(Component);
|