first commit

This commit is contained in:
ronger 2020-06-30 17:50:32 +08:00
parent 2f1a426223
commit fbafa3db60
6 changed files with 50 additions and 42 deletions

View File

@ -144,7 +144,6 @@
let _ts = this;
let activeMenu = _ts.$store.state.activeMenu;
if (activeMenu !== item) {
this.$store.commit('setActiveMenu', item);
if (item === 'topic') {
_ts.$router.push(
{

View File

@ -52,14 +52,13 @@ export default {
** https://nuxtjs.org/guide/plugins
*/
plugins: [
'@/plugins/element-ui',
// '@/plugins/axios'
{src: '@/plugins/element-ui', ssr: true},
{src: '@/plugins/vditor', ssr: false}
],
/*
** Nuxt.js dev-modules
*/
buildModules: [
],
buildModules: [],
/*
** Nuxt.js modules
*/

View File

@ -120,7 +120,7 @@
<script>
import Vue from 'vue';
import { mapState } from 'vuex';
import VditorPreview from 'vditor/dist/method.min';
export default {
name: "ArticleDetail",
validate({params, store}) {
@ -141,6 +141,11 @@
isMobile: state => state.global.isMobile,
})
},
head () {
return {
title: this.article.articleTitle
}
},
data() {
return {
isShow: true,
@ -191,17 +196,17 @@
const previewElement = document.getElementById("articleContent");
// //const outLineElement = document.getElementById("articleToC");
// VditorPreview.setContentTheme('light');
VditorPreview.codeRender(previewElement, 'zh_CN');
VditorPreview.highlightRender({"enable":true,"lineNumber":false,"style":"github"}, previewElement);
VditorPreview.mathRender(previewElement, {
Vue.VditorPreview.codeRender(previewElement, 'zh_CN');
Vue.VditorPreview.highlightRender({"enable":true,"lineNumber":false,"style":"github"}, previewElement);
Vue.VditorPreview.mathRender(previewElement, {
math: {"engine":"KaTeX","inlineDigit":false,"macros":{}},
});
VditorPreview.mermaidRender(previewElement, ".language-mermaid");
VditorPreview.graphvizRender(previewElement);
VditorPreview.chartRender(previewElement);
VditorPreview.mindmapRender(previewElement);
VditorPreview.abcRender(previewElement);
VditorPreview.mediaRender(previewElement);
Vue.VditorPreview.mermaidRender(previewElement, ".language-mermaid");
Vue.VditorPreview.graphvizRender(previewElement);
Vue.VditorPreview.chartRender(previewElement);
Vue.VditorPreview.mindmapRender(previewElement);
Vue.VditorPreview.abcRender(previewElement);
Vue.VditorPreview.mediaRender(previewElement);
//VditorPreview.outlineRender(previewElement, outLineElement);
})
}

View File

@ -78,6 +78,7 @@
}
_ts.$axios.$post('/api/v1/console/login', data).then(function (res) {
console.log(res);
if (res.data) {
if (res.data.message) {
_ts.$message(res.data.message);

4
plugins/vditor.js Normal file
View File

@ -0,0 +1,4 @@
import Vue from 'vue';
import VditorPreview from 'vditor/dist/method.min';
Vue.VditorPreview = VditorPreview

View File

@ -81,24 +81,24 @@ export const actions = {
// const delay = fetchDelay(
// isBrowser
// )
console.log(params)
if (isBrowser) {
Vue.nextTick(() => {
window.scrollTo(0, 300);
})
}
// if (isBrowser) {
// Vue.nextTick(() => {
// window.scrollTo(0, 300);
// })
// }
commit('updateDetailFetching', true)
commit('updateDetailData', {})
// commit('updateDetailData', {})
return this.$axios
.$get(`${ARTICLE_API_PATH}/article/${params.article_id}`)
.then(response => {
return new Promise(resolve => {
commit('updateDetailData', response.data)
commit('updateDetailFetching', false)
// return new Promise(resolve => {
resolve(response)
// delay(() => {
// resolve(response)
// })
// })
})
})
.catch(error => {
commit('updateDetailFetching', false)