UNPKG

@wangofnextdoor/zzd-config

Version:

浙政钉配置和流量分析工具包

37 lines (36 loc) 942 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getAppConfig = void 0; // 默认配置 const defaultConfig = { sapp_id: '51621', sapp_name: 'xjyq', page_id: '', page_name: '', page_url: typeof window !== 'undefined' ? window.location.href : '', }; // 获取当前路由 const getCurRoute = () => { if (typeof window !== 'undefined') { return window.location.pathname; } return ''; }; // 获取页面标题 const getNavigationBarTitleText = () => { if (typeof window !== 'undefined') { return document.title; } return ''; }; // 动态配置 const getAppConfig = () => { return { ...defaultConfig, page_id: getCurRoute(), page_name: getNavigationBarTitleText(), page_url: typeof window !== 'undefined' ? window.location.href : '', }; }; exports.getAppConfig = getAppConfig; exports.default = defaultConfig;