import queryString from 'query-string';
export const getURLHashParams = (key?: string)=>
key ? queryString.parse(window.location.hash.replace(/.*(?=\?)/, ''))[key] : queryString.parse(window.location.hash.replace(/.*(?=\?)/, ''));
const query = getURLHashParams();
if (query?.theme_color === undefined) return;
document.documentElement.style.setProperty('--color-master', `#${query.theme_color}`);
需要安装
query-string
vue2 建议安装 "^7.1.0"