提交 4ddf70ba 编写于 作者: O oasis-cloud

feat: docs 不展示demo问题修复

上级 2273bbbc
<!DOCTYPE html>
<html lang="en">
<!-- <html lang="en" data-prefers-color-scheme='dark'>-->
<head>
<meta charset="utf-8" />
<meta content="telephone=no" name="format-detection" />
<link rel="shortcut icon" href="https://img14.360buyimg.com/imagetools/jfs/t1/167902/2/8762/791358/603742d7E9b4275e3/e09d8f9a8bf4c0ef.png" />
<meta
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
name="viewport"
/>
<title>NutUI - 移动端React组件库</title>
<script src="https://h5.m.jd.com/babelDiy/Zeus/2846ykuM7PwipD9E2RzMj2BGEQpA/plugin/share.min.js"></script>
<style>
html {
background: #f7f7f7;
}
<meta charset="utf-8" />
<meta content="telephone=no" name="format-detection" />
<link rel="shortcut icon" href="https://img14.360buyimg.com/imagetools/jfs/t1/167902/2/8762/791358/603742d7E9b4275e3/e09d8f9a8bf4c0ef.png" />
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=0, viewport-fit=cover">
<title>NutUI - 移动端React组件库</title>
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
a[title="站长统计"] {
display: none;
}
</style>
</head>
<body>
<noscript>
<strong
>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work
properly without JavaScript enabled. Please enable it to
continue.</strong
>
<strong
>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work
properly without JavaScript enabled. Please enable it to
continue.</strong
>
</noscript>
<!-- <div id="app" class="nut-theme-dark"></div> -->
<div id="app" ></div>
<div id="app"></div>
<script type="module" src="/src/sites/mobile/main.tsx"></script>
<script>
//分享配置
var shareOption = {
iconUrl: "https://nutui.jd.com/img/logo_share.png",
url: "https://nutui.jd.com/demo.html#/index",
title: "轻量级移动端React组件库 - NutUI-React 1.0",
desc: "京东风格的React组件库",
};
try {
/*初始化分享*/
share.shareInit(shareOption);
} catch (e) {
console.log(e);
}
</script>
<script type="text/javascript">
var jaq = jaq || [];
jaq.push(["account", "JA2018_1831300"]);
jaq.push(["domain", "jd.com"]);
(function() {
var ja = document.createElement("script");
ja.type = "text/javascript";
ja.async = true;
ja.src = "//wl.jd.com/joya.js";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(ja, s);
})();
</script>
<script
type="text/javascript"
src="https://s23.cnzz.com/z_stat.php?id=1276268086&web_id=1276268086"
></script>
</body>
</html>
......@@ -3,11 +3,14 @@ import config from '@/sites/config/env'
export const getLocale = () => {
let locale = 'zh-CN'
const matched = window.parent.location.href.match(/#\/([a-z-]+)/i)
if (matched) {
;[, locale] = matched
if (config.locales.indexOf(locale) === -1) locale = 'zh-CN'
}
try {
const matched = window.parent.location.href.match(/#\/([a-z-]+)/i)
if (matched) {
;[, locale] = matched
if (config.locales.indexOf(locale) === -1) locale = 'zh-CN'
}
} catch (e) {}
return locale
}
......@@ -17,9 +20,13 @@ const useLocale = (): [string, any] => {
setLocale(getLocale())
}
useEffect(() => {
window.parent.addEventListener('popstate', handlePopState)
try {
window.parent.addEventListener('popstate', handlePopState)
} catch (e) {}
return () => {
window.parent.removeEventListener('popstate', handlePopState)
try {
window.parent.removeEventListener('popstate', handlePopState)
} catch (e) {}
}
}, [])
return [locale, setLocale]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册