云林县网站建设_网站建设公司_Django_seo优化
2025/12/29 22:07:53 网站建设 项目流程

样式:

<select v-model="score"> <option v-for="s in scoreList" :key="s" :value="s"> {{ s }} 星 </option> </select>

代码

mounted() { this.loadComments() },

渲染页面完成后,调用函数。

导入axios使用http链接

import axios from 'axios'

使用例子如下:

axios.get('http://localhost:8080/comment/list', { params: { productId: this.productId } }).then(res => { this.commentList = res.data.data })

就是链接请求:

举例:

http://localhost:8080/comment/list? productId=1001;

axios的post

axios.post('/comment/add', { productId: this.productId, userId: this.userId, content: this.content, score: this.score }).then(() => { alert('评论成功') this.content = '' this.score = 5 this.loadComments() })

其中的productId,userId,content,score以json传给后端,

后端以

RequestBody接收。

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询