mirror of
https://github.com/Xevion/power-math.git
synced 2025-12-06 05:15:56 -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>
|
||||
<div id="app">
|
||||
<div id="expression" v-katex="expression"></div>
|
||||
<button v-on:click="fetchQuestion">
|
||||
Fetch Question
|
||||
</button>
|
||||
</div>
|
||||
</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>
|
||||
|
||||
<script>
|
||||
import axios from "axios";
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
data() {
|
||||
@@ -14,9 +44,24 @@ export default {
|
||||
currentQuestion: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
expression() {
|
||||
return this.currentQuestion != null ? this.currentQuestion.question : "loading";
|
||||
},
|
||||
},
|
||||
mounted: function () {
|
||||
this.$nextTick(() => {
|
||||
this.fetchQuestion();
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
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>
|
||||
|
||||
@@ -1,26 +1,11 @@
|
||||
import Vue from 'vue'
|
||||
import VueKatex from 'vue-katex';
|
||||
import App from './App.vue'
|
||||
import axios from 'axios'
|
||||
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";
|
||||
import 'katex/dist/katex.min.css';
|
||||
|
||||
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.use(VueKatex)
|
||||
|
||||
new Vue({
|
||||
render: h => h(App),
|
||||
|
||||
Reference in New Issue
Block a user