评论配置接口获取
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
const axios = require('axios')
|
||||
// const AV = require('leancloud-storage')
|
||||
window.AV = require('leancloud-storage')
|
||||
// const Valine = require('../lib/Valine.min')
|
||||
@@ -6,11 +7,13 @@ window.AV = require('leancloud-storage')
|
||||
* 可以支持对于AV对象的传参输入, 而不需要暴露全局变量
|
||||
* 但是缺少一些新功能
|
||||
*/
|
||||
// 评论配置
|
||||
const commentConfig = require('../config/comment.json')
|
||||
|
||||
import(/* webpackChunkName: "valine" */ '../lib/Valine.min').then(({default: Valine }) => {
|
||||
commentConfig.valine.config.path = window.location.pathname
|
||||
// commentConfig.valine.config.av = AV
|
||||
new Valine(commentConfig.valine.config)
|
||||
// 从接口获取评论配置
|
||||
axios.get(`${window.themeConfig.root}api/common/valineConfig`).then(res => {
|
||||
let config = res.data
|
||||
config.path = window.location.pathname
|
||||
// config.av = AV
|
||||
new Valine(config)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -43,8 +43,7 @@ Util.addLoadEvent(function() {
|
||||
}
|
||||
})
|
||||
|
||||
const commentConfig = require('../config/comment.json')
|
||||
if(window.themeConfig.isPost && commentConfig.valine.enable) {
|
||||
if(window.themeConfig.isPost && window.themeConfig.comment) {
|
||||
// 文章详情页面, 并且启用了评论, 则加载评论相关代码
|
||||
import(/* webpackChunkName: "comment" */ './comment')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user