-
博客程序:nuxt + vue artalk后端已经部署完成 前端部署 <template>
<div class="wrapper">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/Artalk.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/Artalk.js"></script>
<div id="Comments"></div>
</div>
</template>
<script>
const el = '#Comments';
const pageKey = '';
const pageTitle = '';
const server = 'https://artalk.imhan.cn/api/';
const site = '博客';
export default {
name: 'Comments',
mounted () {
this.comments()
},
methods: {
comments () {
try {
new Artalk({
el,
pageKey,
pageTitle,
server,
site,
})
} catch (e) { }
},
}
}
</script>
<style lang="scss" scoped>
// ...
</style> 控制台报错 Access to fetch at 'https://artalk.imhan.cn/api/get' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Artalk.js:1 POST https://artalk.imhan.cn/api/get net::ERR_FAILED 404
Artalk.js:1 Uncaught (in promise) Error: 网络错误
at Artalk.js:1:51547
at Generator.throw (<anonymous>)
at a (Artalk.js:1:819) |
Beta Was this translation helpful? Give feedback.
Answered by
qwqcode
Feb 17, 2022
Replies: 2 comments
-
原来前端的php版本指向的是 然后出现了这个问题,记录一下,正在研究中 |
Beta Was this translation helpful? Give feedback.
0 replies
-
看了你的代码,前端引入的是 [email protected],而后端 https://artalk.imhan.cn 是 PHP 旧版 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
qwqcode
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
看了你的代码,前端引入的是 [email protected],而后端 https://artalk.imhan.cn 是 PHP 旧版
前端目前已经不再支持 Artalk 的 PHP 后端,你需要部署 Golang 新版
可参考:
https://artalk.js.org/guide/backend/install.html
https://www.bilibili.com/video/BV1cP4y1J7gC