Webapp: sample component with an assets fetch
This commit is contained in:
parent
95963f8820
commit
4e8c24b5f3
|
|
@ -1,6 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
TODO: everything
|
<main-component></main-component>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style>
|
<script>
|
||||||
</style>
|
import MainComponent from "./components/MainComponent.vue";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { MainComponent },
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style></style>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"test": "hello"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<template>
|
||||||
|
<p>{{ value }}</p>
|
||||||
|
<a :href="jsonURL">Test</a>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import jsonURL from "../assets/test.json?url";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "MainComponent",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
value: "Test",
|
||||||
|
jsonURL: jsonURL,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
fetch(jsonURL)
|
||||||
|
.then((v) => v.json())
|
||||||
|
.then((json) => {
|
||||||
|
console.log(json);
|
||||||
|
this.value = json;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped></style>
|
||||||
Loading…
Reference in New Issue