// 提交数据 this.$store.dispatch('submitData', {"prompt":"烦烦烦","keys":"sk-c6e3c04b15af4afd933f4d15282ed524"})

// store.js 中的 action actions: { submitData({ commit }, payload) { axios.post('/api/submit', payload) .then(response => { commit('setResponse', response.data) }) .catch(error => { console.log(error) }) } }

// store.js 中的 mutation mutations: { setResponse(state, response) { state.response = response } }

// 组件中获取响应数据 computed: { response() { return this.$store.state.response }

vue 程序通过 payload 提交数据prompt烦烦烦keyssk-c6e3c04b15af4afd933f4d15282ed524 例程;并接收响应payload

原文地址: https://www.cveoy.top/t/topic/crs4 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录