Commit 6af6df30 authored by 崔佳豪's avatar 崔佳豪

feat: 语音播报全局拦截

parent 78b1991c
Pipeline #48735 skipped with stages
......@@ -8,7 +8,7 @@ import 'file-loader?name=.htaccess!./.htaccess'; // eslint-disable-line import/e
import '@wisdom-utils/utils/lib/helpers/format';
import 'sanitize.css/sanitize.css';
import { Storeage } from '@wisdom-utils/utils/lib/helpers';
import { initGlobalConfig } from './initConfig'
import { initGlobalConfig } from './initConfig';
import './utils/event';
import { render } from './render';
......@@ -21,6 +21,20 @@ window.createStoreage = new Storeage(namespace);
const initLocale = () => {
localStorage.setItem('umi_locale', 'zh-CN');
};
// 语音播报全局拦截
const setMessageVoice = () => {
const rawSpeak = window.speechSynthesis.speak;
window.speechSynthesis.speak = function(...args) {
if (
window.globalConfig &&
window.globalConfig.hasOwnProperty('messageVoice') &&
window.globalConfig.messageVoice === false
)
return;
rawSpeak.apply(window.speechSynthesis, args);
};
};
initGlobalConfig();
render({ appContent: '', loading: true });
initLocale();
setMessageVoice();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment