add config.html,
add config.js, add getURIData function to parse URI search params
This commit is contained in:
parent
3160e0a858
commit
e369456c57
13
config.html
Normal file
13
config.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<title>tronnet - client</title>
|
||||
<link rel="stylesheet" href="css/style.css" type="text/css">
|
||||
<script src="scripts/config.js" type="module"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</template>
|
||||
</html>
|
8
scripts/config.js
Normal file
8
scripts/config.js
Normal file
@ -0,0 +1,8 @@
|
||||
import {request, goToPage, getURIData} from "./utils.js";
|
||||
|
||||
window.addEventListener("DOMContentLoaded", init);
|
||||
|
||||
async function init () {
|
||||
let uriData = getURIData();
|
||||
console.log(uriData);
|
||||
}
|
@ -84,4 +84,9 @@ export function goToPage (page, data={}) {
|
||||
url.searchParams.append(k, data[k]);
|
||||
}
|
||||
window.location.href = url.toString();
|
||||
}
|
||||
|
||||
export function getURIData () {
|
||||
let url = new URL(window.location.href);
|
||||
return Object.fromEntries(url.searchParams);
|
||||
}
|
Loading…
Reference in New Issue
Block a user