【发布时间】:2019-02-12 06:12:12
【问题描述】:
我想在我的 vue.js 应用程序中为我的 axios 发布操作动态创建 URL 路径
下面是动作:
editProduct: function ({dispatch, commit}, payload) {
axios
.put('http://localhost:8081/product/5b5ca691e4f0d93c18e3f6d9', payload)
.then(res => dispatch('loadProducts', res.data))
.catch(function (error) {
console.log(error)
})
.then(() => {
commit('clearAddEditProduct')
})
}
我想用状态中的任何内容替换“5b5ca691e4f0d93c18e3f6d9”
state: { // data
product: {
name: '',
description: '',
externalid: '',
active: '',
id: ''
}
具体是产品 ID
有什么建议吗?
【问题讨论】: