work in progress: frontend functionality with petite-vue

This commit is contained in:
Helmut Merz 2023-02-18 16:48:07 +01:00
parent 3ef54f0d42
commit 56edced4ab
3 changed files with 27 additions and 8 deletions

View file

@ -1,2 +0,0 @@
PetiteVue.createApp({$delimiters: ['{|', '|}']}).mount()

26
assets/js/main.ts Normal file
View file

@ -0,0 +1,26 @@
import { createApp } from './lib/petite-vue.es.js'
createApp({
$delimiters: ['{|', '|}'],
urlParams: new URL(location.href).searchParams,
save
}).mount()
function save(text: string) {
console.log(text)
}
const s: string = 'test-string'
save(s)
for (let i = 0; i < 10; i++) {
setTimeout(function () {
console.log(i);
}, 100 * i);
}
// p = new URL(location.href).searchParams
// id = p.get('id')
// fetch('http://localhost:8125/api/system/poll/service/pclt-0001').
// then((res) => res.json()).then((data) => console.log(data))

View file

@ -1,7 +1,2 @@
<!--<script src="https://unpkg.com/petite-vue"></script>-->
<script src="js/lib/petite-vue.iife.js"></script>
{{ $js := resources.Get "js/index.ts" | js.Build }}
{{ $js := resources.Get "js/main.ts" | js.Build (dict "minify" false) }}
<script src="{{ $js.Permalink }}"></script>
<!--<script>
PetiteVue.createApp({$delimiters: ['{|', '|}']}).mount()
</script>-->