mirror of
https://github.com/Xevion/power-math.git
synced 2025-12-14 08:12:27 -06:00
add katex rendering and question fetching, basic dark theme scss, dev env API url
This commit is contained in:
1
client/.env.development
Normal file
1
client/.env.development
Normal file
@@ -0,0 +1 @@
|
|||||||
|
VUE_APP_API_URL=http://localhost:5000
|
||||||
@@ -1,12 +1,42 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
|
<div id="expression" v-katex="expression"></div>
|
||||||
|
<button v-on:click="fetchQuestion">
|
||||||
|
Fetch Question
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="css">
|
<style lang="scss">
|
||||||
|
html, body {
|
||||||
|
background: hsl(0, 0%, 6%)
|
||||||
|
}
|
||||||
|
|
||||||
|
a, p, span {
|
||||||
|
color: hsl(0, 0%, 91%);
|
||||||
|
text-shadow: hsl(0, 0%, 5%) 5px 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#question-text {
|
||||||
|
font-family: "Computer Modern", serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
#expression {
|
||||||
|
width: 75%;
|
||||||
|
margin: 0 auto;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.katex {
|
||||||
|
font-size: 16em !important;
|
||||||
|
white-space: nowrap;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'App',
|
name: 'App',
|
||||||
data() {
|
data() {
|
||||||
@@ -14,9 +44,24 @@ export default {
|
|||||||
currentQuestion: null
|
currentQuestion: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
expression() {
|
||||||
|
return this.currentQuestion != null ? this.currentQuestion.question : "loading";
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted: function () {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.fetchQuestion();
|
||||||
|
})
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchQuestion() {
|
fetchQuestion() {
|
||||||
}
|
// Fetch the next question, display with KaTeX
|
||||||
|
axios.put(`${process.env.VUE_APP_API_URL}/api/question/`)
|
||||||
|
.then((res) => {
|
||||||
|
this.currentQuestion = res.data
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,26 +1,11 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
import VueKatex from 'vue-katex';
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import axios from 'axios'
|
import 'katex/dist/katex.min.css';
|
||||||
import VueAxios from 'vue-axios'
|
|
||||||
import VueHighlightJS from 'vue-highlightjs'
|
|
||||||
import VueMaterial from 'vue-material'
|
|
||||||
import json from 'highlight.js/lib/languages/css';
|
|
||||||
import 'vue-material/dist/vue-material.min.css'
|
|
||||||
import 'vue-material/dist/theme/default.css'
|
|
||||||
import 'highlight.js/styles/default.css';
|
|
||||||
import InfiniteLoading from "vue-infinite-loading";
|
|
||||||
|
|
||||||
Vue.use(VueHighlightJS, {languages: {json}})
|
|
||||||
Vue.use(VueMaterial)
|
|
||||||
Vue.use(VueAxios, axios)
|
|
||||||
Vue.use(InfiniteLoading, {
|
|
||||||
system: {
|
|
||||||
// throttleLimit: 500,
|
|
||||||
/* other settings need to configure */
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
|
Vue.use(VueKatex)
|
||||||
|
|
||||||
new Vue({
|
new Vue({
|
||||||
render: h => h(App),
|
render: h => h(App),
|
||||||
|
|||||||
Reference in New Issue
Block a user