amis2/examples/mobile.html

94 lines
2.2 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<title>MobileView</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1"
/>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<link rel="stylesheet" href="@fortawesome/fontawesome-free/css/all.css" />
<link
rel="stylesheet"
href="@fortawesome/fontawesome-free/css/v4-shims.css"
/>
2020-11-30 16:53:04 +08:00
<!--DEPENDENCIES_INJECT_PLACEHOLDER-->
<link rel="stylesheet" title="ang" href="amis/lib/themes/ang.css" />
<link
rel="stylesheet"
title="cxd"
disabled
href="amis/lib/themes/cxd.css"
/>
<link
rel="stylesheet"
title="dark"
disabled
href="amis/lib/themes/dark.css"
/>
<link
rel="stylesheet"
title="antd"
disabled
href="amis/lib/themes/antd.css"
/>
<link rel="stylesheet" href="amis/lib/helper.css" />
<style>
.app-wrapper {
position: relative;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="root" class="app-wrapper"></div>
<script src="./mod.js"></script>
<script type="text/javascript">
const themes = [
{
label: '云舍',
value: 'cxd'
},
{
label: 'Ang',
value: 'ang'
},
{
label: 'Dark',
value: 'dark'
},
{
label: 'antd',
value: 'antd'
}
];
// mobile 下先禁掉所有外链避免影响
2020-11-30 16:53:04 +08:00
document.querySelectorAll('link[title]').forEach(item => {
item.disabled = true;
});
let theme = localStorage.getItem('amis-theme') || 'cxd';
2021-09-09 11:09:32 +08:00
if (theme == 'default') {
theme = 'cxd';
}
const linkDom = document.querySelector(`link[title=${theme}]`);
if (linkDom) {
linkDom.disabled = false;
}
2021-09-09 11:09:32 +08:00
if (theme === 'dark') {
document.querySelector('body').classList.add('dark');
}
amis.require(['./mobile.jsx'], function (app) {
app.bootstrap(document.getElementById('root'), {});
});
</script>
</body>
</html>