Commit f5a7fed8 by weiw

fix:处理低版本浏览器无法兼容js的问题

parent 91474132
...@@ -5,13 +5,26 @@ import App from './App' ...@@ -5,13 +5,26 @@ import App from './App'
import './styles/index.less' import './styles/index.less'
import 'github-markdown-css/github-markdown.css' import 'github-markdown-css/github-markdown.css'
import 'react-photo-view/dist/react-photo-view.css' import 'react-photo-view/dist/react-photo-view.css'
import { printText2Console } from './utils/console'
const rootEl = document.getElementById('root') const rootEl = document.getElementById('root')
document.documentElement.classList.add('light') document.documentElement.classList.add('light')
printText2Console() // 添加 Object.hasOwn 的 polyfill
if (!Object.hasOwn) {
Object.defineProperty(Object, 'hasOwn', {
value(object: any, property: PropertyKey) {
if (object == null) {
throw new TypeError('Cannot convert undefined or null to object')
}
return Object.prototype.hasOwnProperty.call(Object(object), property)
},
configurable: true,
enumerable: false,
writable: true,
})
}
// printText2Console()
if (rootEl) { if (rootEl) {
const root = ReactDOM.createRoot(rootEl) const root = ReactDOM.createRoot(rootEl)
......
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