[FORDJ] Add Playground App
This commit is contained in:
parent
85c796b51d
commit
35fcf6088c
5 changed files with 90 additions and 0 deletions
|
|
@ -4,4 +4,5 @@ User : {{.UserName}}
|
|||
{{else}}
|
||||
User : None
|
||||
{{end}}
|
||||
<div id="playground"></div>
|
||||
{{template "base/footer" .}}
|
||||
|
|
|
|||
41
web_src/js/components/Playground.vue
Normal file
41
web_src/js/components/Playground.vue
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
|
||||
<template>
|
||||
<h1 v-if="gameData">{{ gameData.File.Name }}</h1>
|
||||
<div v-if="gameData">
|
||||
{{ gameData.File.name }}
|
||||
<br>
|
||||
<GameStep v-for="step in gameData.File.Steps" :name="step.Items.Name.Value" />
|
||||
</div>
|
||||
<p v-if="serverData">{{ serverData.data }}</p>
|
||||
<button @click="fetchData">Fetch</button>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import GameStep from './Step.vue';
|
||||
export default {
|
||||
components: {
|
||||
GameStep,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
serverData: null,
|
||||
gameData:null,
|
||||
gameValue: null,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.fetchGame();
|
||||
},
|
||||
methods : {
|
||||
async fetchData() {
|
||||
const response = await fetch("http://localhost:3333/time/");
|
||||
this.serverData = await response.json();
|
||||
},
|
||||
async fetchGame() {
|
||||
const response = await fetch("http://localhost:3333/game/");
|
||||
this.gameData = await response.json();
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style></style>
|
||||
33
web_src/js/components/Step.vue
Normal file
33
web_src/js/components/Step.vue
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<template>
|
||||
<div>
|
||||
{{ StepName }} : {{ stepData.result }}
|
||||
</div>
|
||||
<br>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
stepData: "",
|
||||
StepName: this.name,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.fetchData();
|
||||
},
|
||||
props: [
|
||||
'name'
|
||||
],
|
||||
methods : {
|
||||
async fetchData() {
|
||||
const response = await fetch("http://localhost:3333/step", {
|
||||
method: "POST",
|
||||
body: this.StepName,
|
||||
}
|
||||
);
|
||||
this.stepData = await response.json();
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style></style>
|
||||
11
web_src/js/features/playground.js
Normal file
11
web_src/js/features/playground.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import {createApp} from 'vue'
|
||||
import Playground from '../components/Playground.vue'
|
||||
|
||||
export function initPlayground() {
|
||||
const el = document.getElementById('playground');
|
||||
if (!el) return;
|
||||
|
||||
const View = createApp(Playground);
|
||||
View.mount(el);
|
||||
}
|
||||
|
||||
|
|
@ -88,6 +88,8 @@ import {initDirAuto} from './modules/dirauto.js';
|
|||
import {initRepositorySearch} from './features/repo-search.js';
|
||||
import {initColorPickers} from './features/colorpicker.js';
|
||||
|
||||
import {initPlayground} from './features/playground.js';
|
||||
|
||||
// Init Gitea's Fomantic settings
|
||||
initGiteaFomantic();
|
||||
initDirAuto();
|
||||
|
|
@ -190,4 +192,6 @@ onDomReady(() => {
|
|||
initPdfViewer();
|
||||
initScopedAccessTokenCategories();
|
||||
initColorPickers();
|
||||
|
||||
initPlayground();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue