parent
a78659b206
commit
34a397941a
2 changed files with 10 additions and 2 deletions
|
|
@ -25,8 +25,6 @@
|
||||||
</transition>
|
</transition>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import quotes from "../assets/quotes";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "QuoteView",
|
name: "QuoteView",
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -37,6 +35,16 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
var quotes;
|
||||||
|
try {
|
||||||
|
quotes = require('@/assets/quotes/' + this.$i18n.locale + '/quotes');
|
||||||
|
} catch (error) {
|
||||||
|
console.error("No quotes for language");
|
||||||
|
quotes = undefined;
|
||||||
|
}
|
||||||
|
if (!quotes) {
|
||||||
|
quotes = require('@/assets/quotes/en/quotes'); // Default fallback
|
||||||
|
}
|
||||||
const n = quotes.quotes.length;
|
const n = quotes.quotes.length;
|
||||||
const quote = quotes.quotes[Math.floor(Math.random() * n)];
|
const quote = quotes.quotes[Math.floor(Math.random() * n)];
|
||||||
this.quote = quote.quote;
|
this.quote = quote.quote;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue