Skip to content

Commit

Permalink
fix: demo flash of unstyled content
Browse files Browse the repository at this point in the history
  • Loading branch information
onlyhom committed Aug 25, 2022
1 parent 488c6dd commit abf078f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
5 changes: 2 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
name="viewport"
content="width=device-width, minimum-scale=1, maximum-scale=1,user-scalable=no"
/>
<link rel="stylesheet" type="text/css" href="/src/style/demo.css" />
</head>
<body>
<div class="contain">
Expand All @@ -28,9 +29,7 @@ <h1>mobile-select demo</h1>
</div>

<script type="module">
import "/src/style/demo.css";
import MobileSelect from "/src/index.ts";

const weekdayArr = [
"周日",
"周一",
Expand Down Expand Up @@ -330,7 +329,7 @@ <h1>mobile-select demo</h1>
title: "级联数据",
wheels: [{ data: UplinkData }],
initValue: "劳斯莱斯 魅影 标准版",
scrollSpeed: 2,
// scrollSpeed: 2,
onTransitionEnd: function (data, indexArr, msInstance) {
//console.log(data);
},
Expand Down
12 changes: 7 additions & 5 deletions scripts/build-html.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ const buildHtml = async () => {
htmlCode = htmlCode
.replace(
'<script type="module">',
`<link rel="stylesheet" type="text/css" href="./style/demo.css" />
<link rel="stylesheet" type="text/css" href="./style/mobile-select.css" />
<script type="text/javascript" src="./mobile-select.iife.js"></script>
<script type="text/javascript">`
`<link rel="stylesheet" type="text/css" href="./style/mobile-select.css" />
<script type="text/javascript" src="./mobile-select.iife.js"></script>
<script type="text/javascript">`
)
.replace(
'<link rel="stylesheet" type="text/css" href="/src/style/demo.css"/>',
'<link rel="stylesheet" type="text/css" href="./style/demo.css"/>'
)
.replace('import "/src/style/demo.css";', "")
.replace(`import MobileSelect from "/src/${entryFileName}";`, "");
// TODO format 格式化
await fs.writeFile(resolve(targetDir, "demo.html"), htmlCode);
Expand Down

0 comments on commit abf078f

Please sign in to comment.