我有一个 vue cli 3.5.0 项目,正在尝试添加代理,但我无法让它工作。服务器运行在 :5000 上,客户端运行在 :8080 上。下面你可以看到我的代理。但它继续使用 :8080 而不是 :5000
vue.config.js
module.exports = {
devServer: {
proxy: {
'/api': {
target: 'http://localhost:5000',
ws: true,
changeOrigin: true
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是我如何调用请求的示例
const url = '/api/races/'
const config = {
headers: {'Authorization': "Bearer " + localStorage.token}
}
class RaceService {
// Get Races
static getRaces() {
return new Promise(async (resolve, reject) => {
try {
const res = await axios.get(url)
const races = res.data
resolve(races)
} catch (err) { …
Run Code Online (Sandbox Code Playgroud) 我想部署我的应用程序,为此我需要 vue.config.js 文件作为目标 URL。但是我放在这个文件中的所有内容(我必须自己创建)都不起作用。不是构建的输出目录或 devServer 内的代理。有人遇到过同样的问题并得到解决吗?请帮我
const path = require('path')
module.exports = {
outputDir: path.resolve(__dirname, '../server/public'),
devServer: {
proxy: {
'/api': {
target: 'http://localhost:8081/'
}
}
}
};
Run Code Online (Sandbox Code Playgroud)
包.json
{
"name": "restrace",
"version": "1.0.0",
"description": "restrace app",
"author": "Marcel Beks <mbeks1@avans.nl>",
"private": true,
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
"e2e": "node test/e2e/runner.js",
"test": "npm run unit && npm run e2e",
"lint": "eslint --ext .js,.vue src test/unit test/e2e/specs", …
Run Code Online (Sandbox Code Playgroud) 我正在构建一个 Shopware 插件,其中包括店面和管理部分。店面部分工作正常,但我无法使用 Administration:build 命令让管理部分显示在管理页面的菜单中。
我按照 Shopware 文档和 Shopware 课程了解了如何执行此操作。我将它们都匹配了,但仍然没有成功。我这里可能缺少什么吗?
这是我导入插件文件夹的 main.js 文件。
import './module/configurator';
Run Code Online (Sandbox Code Playgroud)
这是我注册插件的插件文件夹中的index.js 文件
import './page/configurator-component-list';
import './page/configurator-component-detail';
import './page/configurator-component-create';
Shopware.Module.register('configurator', {
type: 'plugin',
name: 'Configurator',
color: '#ff3d58',
icon: 'default-shopping-paper-bag-product',
title: 'Configurator',
description: 'Module for registering components',
routes: {
index: {
component: 'configurator-component-list',
path: 'index'
},
detail: {
component: 'configurator-component-detail',
path: 'detail/:id',
meta: {
parentPath: 'configurator.index'
}
},
create: {
component: 'configurator-component-create',
path: 'create',
meta: {
parentPath: 'configurator.index'
}
}
},
navigation: [{
label: 'Configurator',
color: '#ff3d58', …
Run Code Online (Sandbox Code Playgroud)