123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const customStatusBar = () => "./custom-statusbar.js";
- const getVal = (val) => typeof val === "number" ? val + "px" : val;
- const _sfc_main = {
- name: "CustomNavBar",
- components: {
- customStatusBar
- },
- emits: ["clickLeft", "clickRight", "clickTitle"],
- props: {
- dark: {
- type: Boolean,
- default: false
- },
- title: {
- type: String,
- default: ""
- },
- leftText: {
- type: String,
- default: ""
- },
- rightText: {
- type: String,
- default: ""
- },
- leftIcon: {
- type: String,
- default: ""
- },
- rightIcon: {
- type: String,
- default: ""
- },
- fixed: {
- type: [Boolean, String],
- default: false
- },
- color: {
- type: String,
- default: ""
- },
- backgroundColor: {
- type: String,
- default: ""
- },
- statusBar: {
- type: [Boolean, String],
- default: false
- },
- shadow: {
- type: [Boolean, String],
- default: false
- },
- border: {
- type: [Boolean, String],
- default: true
- },
- height: {
- type: [Number, String],
- default: 44
- },
- leftWidth: {
- type: [Number, String],
- default: 60
- },
- rightWidth: {
- type: [Number, String],
- default: 60
- },
- titleFontSize: {
- type: [Number, String],
- default: 17
- },
- leftTitleFontSize: {
- type: [Number, String],
- default: 12
- },
- customClickLeft: {
- type: [Boolean, String],
- default: false
- }
- },
- computed: {
- themeBgColor() {
- if (this.dark) {
- if (this.backgroundColor) {
- return this.backgroundColor;
- } else {
- return this.dark ? "#333" : "#FFF";
- }
- }
- return this.backgroundColor || "#FFF";
- },
- themeColor() {
- if (this.dark) {
- if (this.color) {
- return this.color;
- } else {
- return this.dark ? "#fff" : "#333";
- }
- }
- return this.color || "#333";
- },
- navbarHeight() {
- return getVal(this.height);
- },
- leftIconWidth() {
- return getVal(this.leftWidth);
- },
- rightIconWidth() {
- return getVal(this.rightWidth);
- },
- isCustomClickLeft() {
- return getVal(this.customClickLeft);
- }
- },
- mounted() {
- if (common_vendor.index.report && this.title !== "") {
- common_vendor.index.report("title", this.title);
- }
- },
- methods: {
- onClickLeft() {
- if (this.isCustomClickLeft == false) {
- common_vendor.index.navigateBack();
- }
- this.$emit("clickLeft");
- },
- onClickRight() {
- this.$emit("clickRight");
- },
- onClickTitle() {
- this.$emit("clickTitle");
- }
- }
- };
- if (!Array) {
- const _component_customStatusBar = common_vendor.resolveComponent("customStatusBar");
- const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
- (_component_customStatusBar + _easycom_uni_icons2)();
- }
- const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
- if (!Math) {
- _easycom_uni_icons();
- }
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return common_vendor.e({
- a: $props.statusBar
- }, $props.statusBar ? {} : {}, {
- b: $props.leftIcon.length > 0
- }, $props.leftIcon.length > 0 ? {
- c: common_vendor.p({
- color: $options.themeColor,
- type: $props.leftIcon,
- size: "20"
- })
- } : {}, {
- d: $props.leftText.length
- }, $props.leftText.length ? {
- e: common_vendor.t($props.leftText),
- f: $options.themeColor,
- g: $props.leftTitleFontSize + "px",
- h: !$props.leftIcon.length > 0 ? 1 : ""
- } : {}, {
- i: common_vendor.o((...args) => $options.onClickLeft && $options.onClickLeft(...args)),
- j: $options.leftIconWidth,
- k: $props.title.length > 0
- }, $props.title.length > 0 ? {
- l: common_vendor.t($props.title),
- m: $options.themeColor,
- n: $props.titleFontSize + "px"
- } : {}, {
- o: common_vendor.o((...args) => $options.onClickTitle && $options.onClickTitle(...args)),
- p: $props.rightIcon.length
- }, $props.rightIcon.length ? {
- q: common_vendor.p({
- color: $options.themeColor,
- type: $props.rightIcon,
- size: "22"
- })
- } : {}, {
- r: $props.rightText.length && !$props.rightIcon.length
- }, $props.rightText.length && !$props.rightIcon.length ? {
- s: common_vendor.t($props.rightText),
- t: $options.themeColor
- } : {}, {
- v: common_vendor.o((...args) => $options.onClickRight && $options.onClickRight(...args)),
- w: $options.rightIconWidth,
- x: $options.themeColor,
- y: $options.themeBgColor,
- z: $options.navbarHeight,
- A: $props.fixed ? 1 : "",
- B: $props.shadow ? 1 : "",
- C: $props.border ? 1 : "",
- D: $options.themeBgColor,
- E: $props.fixed
- }, $props.fixed ? common_vendor.e({
- F: $props.statusBar
- }, $props.statusBar ? {} : {}, {
- G: $options.navbarHeight
- }) : {}, {
- H: $props.dark ? 1 : ""
- });
- }
- const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-94e9cc56"], ["__file", "/Users/xy/Desktop/uni_app_project/xs/xs-app/components/custom-navbar/custom-navbar.vue"]]);
- tt.createComponent(Component);
|