新手在线求助vue+element 访问http://localhost:3000/#/,页面总是显示Helloworld

访问http://localhost:3000/#/,页面总是显示Helloworld

main.js代码

import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import 'font-awesome/css/font-awesome.min.css'
import '@/assets/theme/element-theme/index.css'

Vue.config.productionTip = false

Vue.use(ElementUI)
/ eslint-disable no-new /
new Vue({
el: '#app',
router,
components: {

App
},
template: '<App/>'
}) 

router index.js

 import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/components/Home'
import Dashboard from '@/components/Dashboard'

Vue.use(Router)

// 懒加载方式,当路由被访问的时候才加载对应组件
const Login = resolve => require(['@/components/Home'], resolve)

let routes = [{
path: '/',
component: Home,
hidden: true,
children: [{

path: '/',
component: Dashboard,
name: '首页'
}]
}]

const router = new Router({
routes: routes
})

export default router

劳烦各位帮小弟看看

vue

2个回答

let routes = [{
path: '/',
component: Home,
hidden: true,
children: [{

path: '/',
component: Dashboard,
name: '首页'
}]
}]

两个path都是'/'问题大概在这里

去app.vue中看看你就知道了,你这里做的配置只是通过拼接起来的
主页面还是app.vue ,应该是在app.vue里面写了内容,所以导致每个页面都会显示

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
新手在线求助vue+element 访问http://localhost:3000/#/,页面总是显示Helloworld

**访问http://localhost:3000/#/,页面总是显示Helloworld** main.js代码 ``` import Vue from 'vue' import App from './App' import router from './router' import ElementUI from 'element-ui' import 'font-awesome/css/font-awesome.min.css' import '@/assets/theme/element-theme/index.css' Vue.config.productionTip = false Vue.use(ElementUI) / eslint-disable no-new / new Vue({ el: '#app', router, components: { App }, template: '<App/>' }) ``` router index.js ``` import Vue from 'vue' import Router from 'vue-router' import Home from '@/components/Home' import Dashboard from '@/components/Dashboard' Vue.use(Router) // 懒加载方式,当路由被访问的时候才加载对应组件 const Login = resolve => require(['@/components/Home'], resolve) let routes = [{ path: '/', component: Home, hidden: true, children: [{ path: '/', component: Dashboard, name: '首页' }] }] const router = new Router({ routes: routes }) export default router ``` 劳烦各位帮小弟看看

角度错误:http:// localhost:3000 / login的Http失败响应:404 not found

<div class="post-text" itemprop="text"> <p>I want to get login information that user enters at backend. Here is the backend code :- </p> <pre><code>package main import ( "fmt" "net/http" "github.com/gorilla/mux" "github.com/gorilla/handlers" "encoding/json" "log" ) type LoginDetails struct { Username string `json:"username"` Password string `json:"password"` } func login(w http.ResponseWriter, req *http.Request) { var loginData LoginDetails err := json.NewDecoder(req.Body).Decode(&amp;loginData) if err!=nil{ panic(err) } } func main() { fmt.Println("Starting server at http://localhost:3000...") router := mux.NewRouter() router.PathPrefix("/").Handler(http.FileServer(http.Dir("./static/dist/static"))) router.HandleFunc("/login", login) headersOk := handlers.AllowedHeaders([]string{"Authorization"}) methodsOk := handlers.AllowedMethods([]string{"GET", "POST", "OPTIONS"}) log.Fatal(http.ListenAndServe(":3000", handlers.CORS( headersOk, methodsOk)(router))) } </code></pre> <p>Angular code :- </p> <p><strong>login.component.ts</strong> file :- </p> <pre><code>import { Component, OnInit } from '@angular/core'; import { FormGroup, FormControl, FormBuilder } from '@angular/forms'; import { HttpErrorResponse} from '@angular/common/http'; import { LoginService } from './login.service'; import { LoginDetails } from './login'; @Component({ selector: 'app-login', templateUrl: './login.component.html', styleUrls: ['./login.component.css'], providers : [LoginService, LoginDetails] }) export class LoginComponent implements OnInit { loginForm : FormGroup; constructor(private loginData : LoginDetails, private loginservice: LoginService, private _formBuilder : FormBuilder){} ngOnInit() { this.loginForm = this._formBuilder.group({ username : ['username'], password : ['password'] }) } OnSubmit(){ this.loginData.username = this.loginForm.controls.username.value; this.loginData.password = this.loginForm.controls.password.value; this.loginservice.loginUser(this.loginData).subscribe(response =&gt; { console.log(response) },(err: HttpErrorResponse) =&gt; { console.log(err); }); } } </code></pre> <p><strong>login.service.ts</strong> file :- </p> <pre><code>import { Injectable } from '@angular/core'; import { HttpClient, HttpClientModule, HttpHeaders} from '@angular/common /http'; import { Observable } from 'rxjs'; import { LoginDetails } from './login' @Injectable() export class LoginService{ private _url : string = "http://localhost:3000/login"; constructor( private http : HttpClient){} loginUser(loginData : LoginDetails): Observable &lt;any&gt;{ console.log(loginData) return this.http.post(this._url, loginData, {responseType : 'text'}); } } </code></pre> <p>Error I receive is this :- <code>POST http://localhost:3000/login 404 (Not Found)</code>. </p> </div>

vue.js脚手架项目-地址栏:http://localhost:8080/?#/中的?号哪里来的

地址栏中的?号影响体验,想去掉。之前也是一样的步骤,在运行其他项目时没有出现,偏偏这个就出现,谢谢各位大神

XMLHttpRequest无法加载http:// localhost:9090 / receive。 请求的资源上不存在“ Access-Control-Allow-Origin”标头

<div class="post-text" itemprop="text"> <p>I am opening a html file through nginx server and then the html file passes the "POST" request from the dropzone to the nginx server which then proxy_pass to my go server.This go server then accepts the request.</p> <p>But when i try to use my html file and drop something in the dropzone i get the error :</p> <pre><code>XMLHttpRequest cannot load http://localhost:9090/receive. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9009' is therefore not allowed access. </code></pre> <p>PLease help me out.</p> </div>

浏览器访问http://localhost:8080 出现 400 错误

* 我是在myeclipse下运行的tomcat * 运行结果如下: * 2016-12-8 20:20:14 org.apache.catalina.core.AprLifecycleListener init 信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Users\new\AppData\Local\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\bin;C:\Users\new\AppData\Local\Genuitec\Common\plugins\com.genuitec.eclipse.easie.tomcat.myeclipse_8.6.0.me201007231647\tomcat\bin 2016-12-8 20:20:14 org.apache.coyote.http11.Http11Protocol init 信息: Initializing Coyote HTTP/1.1 on http-8080 2016-12-8 20:20:14 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 1096 ms 2016-12-8 20:20:14 org.apache.catalina.core.StandardService start 信息: Starting service Catalina 2016-12-8 20:20:14 org.apache.catalina.core.StandardEngine start 信息: Starting Servlet Engine: Apache Tomcat/6.0.13 2016-12-8 20:20:17 com.sun.faces.config.ConfigureListener$WebXmlProcessor scanForFacesServlet 警告: Unable to process deployment descriptor for context 'null' 2016-12-8 20:20:17 com.sun.faces.config.ConfigureListener contextInitialized 信息: Initializing Sun's JavaServer Faces implementation (1.2_04-b07-FCS) for context '/fourth' 2016-12-8 20:20:20 com.sun.faces.config.ConfigureListener$WebXmlProcessor scanForFacesServlet 警告: Unable to process deployment descriptor for context 'null' 2016-12-8 20:20:20 com.sun.faces.config.ConfigureListener contextInitialized 信息: Initializing Sun's JavaServer Faces implementation (1.2_04-b07-FCS) for context '/six' 2016-12-8 20:20:23 org.apache.coyote.http11.Http11Protocol start 信息: Starting Coyote HTTP/1.1 on http-8080 2016-12-8 20:20:23 org.apache.jk.common.ChannelSocket init 信息: JK: ajp13 listening on /0.0.0.0:8009 2016-12-8 20:20:23 org.apache.jk.server.JkMain start 信息: Jk running ID=0 time=0/71 config=null 2016-12-8 20:20:23 org.apache.catalina.startup.Catalina start 信息: Server startup in 8836 ms 也进行了发布![图片说明](https://img-ask.csdn.net/upload/201612/08/1481201792_329311.png) 然后打开浏览器就出现400错误 排除了JDK问题

reactjs+springboot修改表格报错:PUT http://localhost:3000/xxx 405 (Method Not Allowed)

用MyBatis update方法修改数据,页面报错: PUT http://localhost:3000/xxx 405 (Method Not Allowed) SpringBoot后台报错: WARN 12144 --- [nio-8080-exec-5] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PUT' not supported] 下面是代码: ``` class StaffEdit extends Component { emptyItem = { name: '', address: '', city: '', stateOrProvince: '', country: '', postalCode: '' }; constructor(props) { super(props); this.state = { item: this.emptyItem }; this.handleChange = this.handleChange.bind(this); this.handleSubmit = this.handleSubmit.bind(this); } async componentDidMount() { if (this.props.match.params.id !== 'new') { const staffAO = await (await fetch(`/api/staff/${this.props.match.params.id}`)).json(); this.setState({item: staffAO}); } } handleChange(event) { const target = event.target; const value = target.value; const name = target.name; let item = {...this.state.item}; item[name] = value; this.setState({item}); } async handleSubmit(event) { event.preventDefault(); const {item} = this.state; await fetch('/api/staff', { method: (item.id) ? 'PUT' : 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, body: JSON.stringify(item), }); this.props.history.push('/staffs'); } render() { const {item} = this.state; const title = <h2>{item.id ? 'Edit Staff' : 'Add Staff'}</h2>; return <div> <AppNavbar/> <Container> {title} <Form onSubmit={this.handleSubmit}> <FormGroup> <Label for="name">Name</Label> <Input type="text" name="name" id="name" value={item.name || ''} onChange={this.handleChange} autoComplete="name"/> </FormGroup> <FormGroup> <Label for="department">Department</Label> <Input type="text" name="department" id="department" value={item.department || ''} onChange={this.handleChange} autoComplete="Chemistry"/> </FormGroup> <FormGroup> <Label for="position">Position</Label> <Input type="text" name="position" id="position" value={item.position || ''} onChange={this.handleChange} autoComplete="unknown"/> </FormGroup> <div className="row"> <FormGroup className="col-md-4 mb-3"> <Label for="permission">Permission</Label> <Input type="text" name="permission" id="permission" value={item.permission || ''} onChange={this.handleChange} autoComplete="all"/> </FormGroup> </div> <FormGroup> <Button color="primary" type="submit">Save</Button>{' '} <Button color="secondary" tag={Link} to="/staffs">Cancel</Button> </FormGroup> </Form> </Container> </div> } } export default withRouter(StaffEdit); ``` ``` public class StaffManagementController { private StaffManagementFunction function; private final org.slf4j.Logger log = LoggerFactory.getLogger(StaffManagementController.class); public StaffManagementController(StaffManagementFunction function) { this.function = function; } @PutMapping("/staff/{id}") ResponseEntity<StaffManagement> editStaff(@PathVariable Long id, @Valid @RequestBody StaffManagementArgumentObject staffAO) throws Exception { staffAO.setId(id); log.info("Request to update staff: {}", staffAO); StaffManagement result = function.updateStaff(staffAO); return ResponseEntity.ok().body(result); } ``` Controller测试过可以修改数据库,但是用页面调用就报错,新手请高手指教!谢谢了!

无法从Web应用程序连接到localhost:3000

<div class="post-text" itemprop="text"> <p>I'm working on some boilerplate code to get a VueJS frontend working with a Go-powered backend (using <code>gorilla/mux</code> for a router):</p> <p>Currently, I seem to have everything working for the most part. I'm serving a static HTML file via Go and rendering Vue stuff with it that's being bundled with webpack (webpack-dev-server currently, not a physical bundle), and I'm having a weird issue:</p> <p>In my browser, Firefox keeps telling me the following:</p> <p><code>Firefox can’t establish a connection to the server at http://localhost:3000/__webpack_hmr.</code></p> <p>Yet, when I change Vue components and save them, they're auto-refreshing in the browser as I would expect. I'm really confused, I guess, I don't know why this is happening.</p> <p>I've tried changing the port that my Go server operates on, and it always seems to fail connection at <code>http://localhost:&lt;Go Server Port&gt;/__webpack_hmr</code>.</p> <p>Any thoughts? Maybe there's a step I'm missing or the setup is more complicated than I thought it was.</p> <p>Do I need to be running an Express server and using the webpack-based Middleware to fix this error? If so, that sounds silly if I'm using Go for the backend (why would I run two servers?). Am I doing something wrong?</p> <p>As for the Go side of things, I've tried both running the Go server on a different port and having the webpack server run on different ports and such, but it always fails to connect at <code>http://localhost:&lt;Go Server Port&gt;/__webpack_hmr</code>. </p> <p>Maybe this is more complicated to set up than I thought it was, or since it seems to be "working", I can safely ignore this error? I dunno.</p> </div>

菜鸟学习轮播图数据的加载,总是加不成功。请求大神指导

![图片说明](https://img-ask.csdn.net/upload/201812/27/1545897254_678805.jpg) 它总是出这个怎么解决啊? :8080/#/home:1 Access to XMLHttpRequest at 'http://vue.studyit.io/api/getlunbo' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. :8080/#/home:1 Uncaught (in promise) Response {url: "http://vue.studyit.io/api/getlunbo", ok: false, status: 0, statusText: "", headers: Headers, …}

vue启动 cannot get 怎么解决,进来看看

浏览器打印如下: Refused to load the image 'http://localhost:8082/favicon.ico' because it violates the following Content Security Policy directive: "default-src 'none'". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback. localhost/:1 Failed to load resource: the server responded with a status of 404 (Not Found) 请问怎么解决 补充,应该是下面的原因引起的,启动时候会报这些错: error in ./src/views/auditmgr/systemreport/component/TimeReport.vue Module build failed: ValidationError: CSS Loader Invalid Options options should NOT have additional properties at validateOptions (D:\yunxiazi-portal-ui\node_modules\schema-utils\src\validateOptions.js:32:11) at Object.loader (D:\yunxiazi-portal-ui\node_modules\css-loader\dist\index.js:44:28) @ ./~/vue-style-loader!./~/css-loader/dist/cjs.js?{"minimize":false,"sourceMap":false}!./~/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-53530556","scoped":false,"hasInlineConfig":false}!./~/less-loader/dist/cjs.js?{"sourceMap":false}!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/views/auditmgr/systemreport/component/TimeReport.vue 4:14-436 13:3-17:5 14:22-444 @ ./src/views/auditmgr/systemreport/component/TimeReport.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/views/auditmgr/opsreport/component/OpsReportBase.vue @ ./src/views/auditmgr/opsreport/component/OpsReportBase.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/views/auditmgr/opsreport/child/OpsTime.vue @ ./src/views/auditmgr/opsreport/child/OpsTime.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/views/auditmgr/opsreport/OpsReport.vue @ ./src/views/auditmgr/opsreport/OpsReport.vue @ ./src/router/index.js @ ./src/main.js @ multi ./build/dev-client ./src/main.js error in ./src/components/tabs/YabTabBar.vue Module build failed: ValidationError: CSS Loader Invalid Options options should NOT have additional properties at validateOptions (D:\yunxiazi-portal-ui\node_modules\schema-utils\src\validateOptions.js:32:11) at Object.loader (D:\yunxiazi-portal-ui\node_modules\css-loader\dist\index.js:44:28) @ ./~/vue-style-loader!./~/css-loader/dist/cjs.js?{"minimize":false,"sourceMap":false}!./~/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-6d0be1e9","scoped":false,"hasInlineConfig":false}!./~/less-loader/dist/cjs.js?{"sourceMap":false}!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/components/tabs/YabTabBar.vue 4:14-411 13:3-17:5 14:22-419 @ ./src/components/tabs/YabTabBar.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/components/tabs/YabTabNav.vue @ ./src/components/tabs/YabTabNav.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/components/tabs/YabTab.vue @ ./src/components/tabs/YabTab.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/proxy/record/sidebar/RecordSidebar.vue @ ./src/proxy/record/sidebar/RecordSidebar.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/proxy/Record.vue @ ./src/proxy/Record.vue @ ./src/proxy/record.js @ multi ./build/dev-client ./src/proxy/record.js error in ./src/proxy/connect/sidebar/dialog/SidebarNetdiskFileUploadDialog.vue Module build failed: ValidationError: CSS Loader Invalid Options options should NOT have additional properties at validateOptions (D:\yunxiazi-portal-ui\node_modules\schema-utils\src\validateOptions.js:32:11) at Object.loader (D:\yunxiazi-portal-ui\node_modules\css-loader\dist\index.js:44:28) @ ./~/vue-style-loader!./~/css-loader/dist/cjs.js?{"minimize":false,"sourceMap":false}!./~/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-1423437a","scoped":false,"hasInlineConfig":false}!./~/less-loader/dist/cjs.js?{"sourceMap":false}!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/proxy/connect/sidebar/dialog/SidebarNetdiskFileUploadDialog.vue 4:14-456 13:3-17:5 14:22-464 @ ./src/proxy/connect/sidebar/dialog/SidebarNetdiskFileUploadDialog.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/proxy/connect/sidebar/children/SidebarFileManageBtns.vue @ ./src/proxy/connect/sidebar/children/SidebarFileManageBtns.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/proxy/connect/sidebar/children/SidebarFileList.vue @ ./src/proxy/connect/sidebar/children/SidebarFileList.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/proxy/connect/sidebar/GuacClientSidebar.vue @ ./src/proxy/connect/sidebar/GuacClientSidebar.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/proxy/Connect.vue @ ./src/proxy/Connect.vue @ ./src/proxy/connect.js @ multi ./build/dev-client ./src/proxy/connect.js error in ./src/proxy/connect/sidebar/dialog/SidebarFileSaveNetdiskDialog.vue Module build failed: ValidationError: CSS Loader Invalid Options options should NOT have additional properties at validateOptions (D:\yunxiazi-portal-ui\node_modules\schema-utils\src\validateOptions.js:32:11) at Object.loader (D:\yunxiazi-portal-ui\node_modules\css-loader\dist\index.js:44:28) @ ./~/vue-style-loader!./~/css-loader/dist/cjs.js?{"minimize":false,"sourceMap":false}!./~/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-5ab1ea24","scoped":false,"hasInlineConfig":false}!./~/less-loader/dist/cjs.js?{"sourceMap":false}!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/proxy/connect/sidebar/dialog/SidebarFileSaveNetdiskDialog.vue 4:14-454 13:3-17:5 14:22-462 @ ./src/proxy/connect/sidebar/dialog/SidebarFileSaveNetdiskDialog.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/proxy/connect/sidebar/children/SidebarFileManageBtns.vue @ ./src/proxy/connect/sidebar/children/SidebarFileManageBtns.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/proxy/connect/sidebar/children/SidebarFileList.vue @ ./src/proxy/connect/sidebar/children/SidebarFileList.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/proxy/connect/sidebar/GuacClientSidebar.vue @ ./src/proxy/connect/sidebar/GuacClientSidebar.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/proxy/Connect.vue @ ./src/proxy/Connect.vue @ ./src/proxy/connect.js @ multi ./build/dev-client ./src/proxy/connect.js error in ./src/components/yab-transfer-ex/yab-transfer-new/transfer-panel.vue Module build failed: ValidationError: CSS Loader Invalid Options options should NOT have additional properties at validateOptions (D:\yunxiazi-portal-ui\node_modules\schema-utils\src\validateOptions.js:32:11) at Object.loader (D:\yunxiazi-portal-ui\node_modules\css-loader\dist\index.js:44:28) @ ./~/vue-style-loader!./~/css-loader/dist/cjs.js?{"minimize":false,"sourceMap":false}!./~/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-7156e841","scoped":false,"hasInlineConfig":false}!./~/less-loader/dist/cjs.js?{"sourceMap":false}!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/components/yab-transfer-ex/yab-transfer-new/transfer-panel.vue 4:14-428 13:3-17:5 14:22-436 @ ./src/components/yab-transfer-ex/yab-transfer-new/transfer-panel.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/components/yab-transfer-ex/yab-transfer-new/main.vue @ ./src/components/yab-transfer-ex/yab-transfer-new/main.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/components/yab-transfer-ex/yab-transfer-ex.vue @ ./src/components/yab-transfer-ex/yab-transfer-ex.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/views/workorder/opsworkorder/dialog/opsWorkOrderAccountEdit.vue @ ./src/views/workorder/opsworkorder/dialog/opsWorkOrderAccountEdit.vue @ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/views/workorder/opsworkorder/OpsWorkOrderDetail.vue @ ./src/views/workorder/opsworkorder/OpsWorkOrderDetail.vue @ ./src/router/index.js @ ./src/main.js @ multi ./build/dev-client ./src/main.js error in ./src/proxy/connect/sidebar/children/SidebarDialogBreadcrumb.vue Module build failed: ValidationError: CSS Loader Invalid Options options should NOT have additional properties

已拦截跨源请求:同源策略禁止读取位于 http://www.betax-serve.com:8086/login 的远程资源。(原因:CORS 头缺少 'Access-Control-Allow-Origin')。

自己做了一个基于Vue-element-ui的管理系统,后端用的phpthink框架,phpstudy+Apache作为后端服务器,在登录时firefox浏览器的控制台报错. ![图片说明](https://img-ask.csdn.net/upload/202004/28/1588067884_890343.png) 开始把问题定位到phpthink的入口文件index.php没有设置请求头,但是在检查index.php文件时发现并没有错误。(附上index.php) ![图片说明](https://img-ask.csdn.net/upload/202004/28/1588068391_867950.png) 再检查服务器,在网上查了很多解决方法修改httpd.conf文件但是也是无济于事,检查host文件 ![图片说明](https://img-ask.csdn.net/upload/202004/28/1588068714_201061.png) 也没发现什么错误。 自己搞了两天了问题始终没有解决!!请求各位大神能够帮忙解决小弟燃眉之急!!

ECONNREFUSED用于从localhost到另一个localhost的代理请求

<div class="post-text" itemprop="text"> <p>To begin, I'm new to angular and I'm following a <a href="https://youtu.be/2OHbjep_WjQ" rel="nofollow noreferrer">tutorial video</a> step by step. I've been stuck on this issue for nearly 2 weeks and have spent many hours looking for solutions in other similar forums. I realize this is a common error, but after trying a couple dozen or so solutions but finding no success I figure I may as well post my experience and maybe it can shed some light on this problem many of us seem to be having.</p> <h1>The Issue</h1> <p>The error occurs while following along for the "Angular Tutorial #13" part of the video which starts around 1:42:00. I follow all steps exactly as shown in the video but I encounter the following error message in the terminal in which I run "npm start" : <br><code>[HPM] Error occurred while trying to proxy request /api/file.php from localhost:4200 to http://localhost:1234 (ECONNREFUSED)</code><br> My package.json scripts for "start": "ng serve --proxy-config proxyconfig.json" and my proxyconfig.json contains: <br> </p> <pre><code>{ "/api":{ "target": "http://localhost:1234", "secure": false, "changeOrigin": true } } </code></pre> <p>In CMD I navigate to the folder "intro2angular" which is the root of "/test/api/file.php" and I run <br><code>php -S localhost:1234</code> prior to running <code>npm start</code> in the powershell in VisualStudioCode. Then I run <code>npm start</code>. Code compiles successfully. In Chrome, if I go to <code>http://localhost:1234/test/api/file.php</code> then the file is displayed in the browser. <strong>However</strong>, if I go to <code>http://localhost:4200</code> and click an anchor which executes the code to request <em>file.php</em> then the <code>[HPM] Error occurred while trying to proxy request /api/file.php from localhost:4200 to http://localhost:1234 (ECONNREFUSED)</code> error is displayed in terminal. In the <em>Network</em> tab of Developer Tools in Chrome, when I check the Headers for <em>file.php</em> I see the follow: </p> <pre><code>Request URL: http://localhost:4200/api/file.php Request Method: GET Status Code: 504 Gateway Timeout Remote Address: 127.0.0.1:4200 Referrer Policy: no-referrer-when-downgrade </code></pre> <p>Forgive me for being verbose in explaining every step I followed, but since I've seen several similar forum posts regarding the ECONNREFUSED error being raised while trying to use a proxy, I thought that including every minor detail may be necessary to distinguish the source of the error in this instance. If any more details/code is necessary I'm more than happy to include it. </p> <h2> Solutions I've tried thus far </h2> <p>Note that this is not a complete list, I've tried several other solutions but these seem to be the most common which have worked for others. Also, I'm not saying that I wouldn't give these solutions another try as I am open to any and all suggestions. </p> <ol> <li>specifying random localhost ports for both the angular app and file.php</li> <li>using <code>setTimeout</code> to add a delay to the <code>.getData()</code> function call</li> <li>disabling firewall</li> <li>including the option <code>"pathRewrite": {"^/api" : ""}</code> to <em>proxyconfig.json</em></li> </ol> <p>I appreciate any and all help/suggestions/discussions around this issue as I've had no success on my own and I am unable to continue with the angular tutorial until this issue is resolved. Thank you in advance.</p> </div>

vue2本地 localhost 测试时 后台数据库是 localhost 如何获取数据库中值

项目是用Vue2脚手架安装的 npm run dev 打开的本地页面 http://localhost:8081 ![图片说明](https://img-ask.csdn.net/upload/201807/30/1532936923_295757.png) 后台数据地址链接 http://localhost:8080/ZK/restservices/http/single/...

初始化的vue项目启动成功但是不能访问

``` E:\pro_person\vue\vue_project>npm run dev > vue_project@1.0.0 dev E:\pro_person\vue\vue_project > webpack-dev-server --inline --progress --config build/webpack.dev.conf.js 95% emitting DONE Compiled successfully in 2598ms 4:21:28 PM I Your application is running here: http://localhost:8080 ``` 以上是控制台的启动信息,没有报错,提示是启动成功了的,但是不管是输入http://localhost:8080或http://127.0.0.1:8080都不能访问。新手,是按照官方流程搭建的环境,win10 英文版的系统。 ``` C:\Users\john>node -v v11.1.0 C:\Users\john>vue -V 2.9.6 ```

如何才能直接访问:调用微信的统一下单接口返回的二维码链接?

直接在安卓手机点击 weixin://wxpay/bizpayurl?pr=4TExlTw 可以访问,但是苹果手机就不行 安卓手机: ![图片说明](https://img-ask.csdn.net/upload/201705/31/1496198924_850918.png) 效果图: ![图片说明](https://img-ask.csdn.net/upload/201705/31/1496198944_135779.jpg) 苹果手机:点击无效果 直接扫描生成的二维码却都能打开 ![图片说明](https://img-ask.csdn.net/upload/201705/31/1496199034_115769.png) 公司要求不通过扫码,直接在微信里面直接访问这个链接,目前找遍了各大论坛,都没发现有什么方法可以直接访问,别人都是通过生成二维码扫码的;请教下各位大大,微信有没接口或者有没什么方案可以实现这个需求?谢谢

js 错误对象 err.stack 用“console 控制台输出”与“实际字符串”不一致问题

背景:最近在做一个前端错误监控系统,要求收集 js 错误信息堆栈等。使用 vue+webpack 技术。 js 错误对象 Error 下的错误堆栈 stack 。 ``` const error = new TypeErrpr(); console.log(error.stack); // console 控制台输出 JSON.stringify(error.stack); // 实际字符串 ``` 使用 console.log 控制台输出如下(显示行号、堆栈信息正确): ``` TypeError: this.b is not a function at Object.aa (common.js?cf45:119) at VueComponent.errorInJSHandler (Home.vue?76f2:104) at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854) at VueComponent.invoker (vue.runtime.esm.js?2b0e:2179) at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854) at VueComponent.Vue.$emit (vue.runtime.esm.js?2b0e:3888) at VueComponent.handleClick (element-ui.common.js?5c96:9417) at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854) at HTMLButtonElement.invoker (vue.runtime.esm.js?2b0e:2179) at HTMLButtonElement.original._wrapper (vue.runtime.esm.js?2b0e:6917) ``` 但如果直接在页面显示或者保存为字符串,变成如下(显示行号、堆栈信息错误): ``` TypeError: this.b is not a function at Object.aa (webpack-internal:///./src/utils/common.js:173:10) at VueComponent.errorInJSHandler (webpack-internal:///./node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/views/Home.vue?vue&type=script&lang=js&:108:61) at invokeWithErrorHandling (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:1853:26) at VueComponent.invoker (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:2178:14) at invokeWithErrorHandling (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:1853:26) at VueComponent.Vue.$emit (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:3882:9) at VueComponent.handleClick (webpack-internal:///./node_modules/element-ui/lib/element-ui.common.js:9417:12) at invokeWithErrorHandling (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:1853:26) at HTMLButtonElement.invoker (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:2178:14) at HTMLButtonElement.original._wrapper (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:6907:25) ``` 怀疑是经过 webpack 打包的坑,想问各位,我如何才能获取到正确的堆栈信息( console.log 控制台输出)? ## **补充:**已找到解决方法,使用mozilla的sourcemap库(https://github.com/mozilla/source-map#sourcemapconsumerwith)即可通过打包后的错误堆栈及sourceMap文件中找到正确行列位置、文件名字等信息

D3js 导入本地json文件产生跨域问题?

使用D3.js。在使用d3.json('relation.json',function)方法时,浏览器报d3.v3.min.js:1 Access to XMLHttpRequest at 'file:///C:/Users/Administrator/Desktop/d3/relation.json' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.我的json文件是本地的,请问如何解决。谢谢

vue.cli第一次配置好了,localhost:8080能显示。但是我关了电脑或者程序再次输入就不能显示了

查了下说 进入项目输入 _npm run dev_ 启动了就好了 但是它报这个错!还是显示不了!! **求各位大佬帮忙看哈!** ![图片说明](https://img-ask.csdn.net/upload/202002/23/1582463642_388670.png)

XML 解析错误:语法错误 位置:

![图片说明](https://img-ask.csdn.net/upload/201805/13/1526190084_220915.jpg) ![图片说明](https://img-ask.csdn.net/upload/201805/13/1526190096_40417.jpg) 今天在使用原生态ajax的时候,在调用doajax方法时,提示xml解析错误,语法错误,网上有人说是编码问题,但是针对struts2的,而我项目中又没有,给的错误信息很少,不知道如何下手,有大佬知道是什么问题吗?感谢

vue-element-admin 如何在本地跑通?

下载的 vue-element-admin 在VScode上跑出错。 在安装npm时报如下错误, 尝试了网上的添加环境变量仍未解决,求大佬帮忙!!! npm ERR! code ENOGIT npm ERR! Error while executing: npm ERR! undefined ls-remote -h -t ssh://git@github.com/sohee-lee7/Squire.git npm ERR! npm ERR! undefined npm ERR! No git binary found in $PATH npm ERR! npm ERR! Failed using git. npm ERR! Please check if you have git installed and in your PATH. npm ERR! A complete log of this run can be found in: npm ERR! D:\soft\NodeJS\node_cache\_logs\2019-02-13T07_44_02_375Z-debug.log

请教:UEditor编辑器上传图片报错,描述如下:

image.js:23 Uncaught ReferenceError: $G is not definedinitTabs @ image.js:23window.onload @ image.js:16 ueditor.all.js:8247 GET http://localhost:8080/poms-web/assets/ueditor/jsp/controller.jsp?action=config&&noCache=1470882297305 500 (Internal Server Error)doAjax @ ueditor.all.js:8247UE.ajax.e.request @ ueditor.all.js:8391(anonymous function) @ ueditor.all.js:8088 ueditor.all.js:8111 请求后台配置项http错误,上传功能将不能正常使用!showErrorMsg @ ueditor.all.js:8111UE.ajax.request.onerror @ ueditor.all.js:8102xhr.onreadystatechange @ ueditor.all.js:8239

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

CSDN:因博主近期注重写专栏文章(已超过150篇),订阅博主专栏人数在突增,近期很有可能提高专栏价格(已订阅的不受影响),提前声明,敬请理解!

CSDN:因博主近期注重写专栏文章(已超过150篇),订阅博主专栏人数在突增,近期很有可能提高专栏价格(已订阅的不受影响),提前声明,敬请理解! 目录 博客声明 大数据了解博主粉丝 博主的粉丝群体画像 粉丝群体性别比例、年龄分布 粉丝群体学历分布、职业分布、行业分布 国内、国外粉丝群体地域分布 博主的近期访问每日增量、粉丝每日增量 博客声明 因近期博主写专栏的文章越来越多,也越来越精细,逐步优化文章。因此,最近一段时间,订阅博主专栏的人数增长也非常快,并且专栏价

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

培训班出来的人后来都怎么样了?(二)

接着上回说,培训班学习生涯结束了。后面每天就是无休止的背面试题,不是没有头脑的背,培训公司还是有方法的,现在回想当时背的面试题好像都用上了,也被问到了。回头找找面试题,当时都是打印下来天天看,天天背。 不理解呢也要背,面试造飞机,上班拧螺丝。班里的同学开始四处投简历面试了,很快就有面试成功的,刚开始一个,然后越来越多。不知道是什么原因,尝到胜利果实的童鞋,不满足于自己通过的公司,嫌薪水要少了,选择...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

工作八年,月薪60K,裸辞两个月,投简历投到怀疑人生!

近日,有网友在某职场社交平台吐槽,自己裸辞两个月了,但是找工作却让自己的心态都要崩溃了,全部无果,不是已查看无回音,就是已查看不符合。 “工作八年,两年一跳,裸辞两个月了,之前月薪60K,最近找工作找的心态崩了!所有招聘工具都用了,全部无果,不是已查看无回音,就是已查看不符合。进头条,滴滴之类的大厂很难吗???!!!投简历投的开始怀疑人生了!希望 可以收到大厂offer” 先来看看网...

97年世界黑客编程大赛冠军作品(大小仅为16KB),惊艳世界的编程巨作

这是世界编程大赛第一名作品(97年Mekka ’97 4K Intro比赛)汇编语言所写。 整个文件只有4095个字节, 大小仅仅为16KB! 不仅实现了3D动画的效果!还有一段震撼人心的背景音乐!!! 内容无法以言语形容,实在太强大! 下面是代码,具体操作看最后! @echo off more +1 %~s0|debug e100 33 f6 bf 0 20 b5 10 f3 a5...

不要再到处使用 === 了

我们知道现在的开发人员都使用 === 来代替 ==,为什么呢?我在网上看到的大多数教程都认为,要预测 JavaScript 强制转换是如何工作这太复杂了,因此建议总是使用===。这些都...

什么是a站、b站、c站、d站、e站、f站、g站、h站、i站、j站、k站、l站、m站、n站?00后的世界我不懂!

A站 AcFun弹幕视频网,简称“A站”,成立于2007年6月,取意于Anime Comic Fun,是中国大陆第一家弹幕视频网站。A站以视频为载体,逐步发展出基于原生内容二次创作的完整生态,拥有高质量互动弹幕,是中国弹幕文化的发源地;拥有大量超粘性的用户群体,产生输出了金坷垃、鬼畜全明星、我的滑板鞋、小苹果等大量网络流行文化,也是中国二次元文化的发源地。 B站 全称“哔哩哔哩(bilibili...

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

MySQL性能优化(五):为什么查询速度这么慢

前期回顾: MySQL性能优化(一):MySQL架构与核心问题 MySQL性能优化(二):选择优化的数据类型 MySQL性能优化(三):深入理解索引的这点事 MySQL性能优化(四):如何高效正确的使用索引 前面章节我们介绍了如何选择优化的数据类型、如何高效的使用索引,这些对于高性能的MySQL来说是必不可少的。但这些还完全不够,还需要合理的设计查询。如果查询写的很糟糕,即使表结构再合理、索引再...

用了这个 IDE 插件,5分钟解决前后端联调!

点击上方蓝色“程序猿DD”,选择“设为星标”回复“资源”获取独家整理的学习资料!作者 |李海庆我是一个 Web 开发前端工程师,受到疫情影响,今天是我在家办公的第78天。开发了两周,...

大厂的 404 页面都长啥样?最后一个笑了...

每天浏览各大网站,难免会碰到404页面啊。你注意过404页面么?猿妹搜罗来了下面这些知名网站的404页面,以供大家欣赏,看看哪个网站更有创意: 正在上传…重新上传取消 腾讯 正在上传…重新上传取消 网易 淘宝 百度 新浪微博 正在上传…重新上传取消 新浪 京东 优酷 腾讯视频 搜...

【高并发】高并发秒杀系统架构解密,不是所有的秒杀都是秒杀!

网上很多的文章和帖子中在介绍秒杀系统时,说是在下单时使用异步削峰来进行一些限流操作,那都是在扯淡! 因为下单操作在整个秒杀系统的流程中属于比较靠后的操作了,限流操作一定要前置处理,在秒杀业务后面的流程中做限流操作是没啥卵用的。

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

代码注释如此沙雕,会玩还是你们程序员!

某站后端代码被“开源”,同时刷遍全网的,还有代码里的那些神注释。 我们这才知道,原来程序员个个都是段子手;这么多年来,我们也走过了他们的无数套路… 首先,产品经理,是永远永远吐槽不完的!网友的评论也非常扎心,说看这些代码就像在阅读程序员的日记,每一页都写满了对产品经理的恨。 然后,也要发出直击灵魂的质问:你是尊贵的付费大会员吗? 这不禁让人想起之前某音乐app的穷逼Vip,果然,穷逼在哪里都是...

Java14 新特性解读

Java14 已于 2020 年 3 月 17 号发布,官方特性解读在这里:https://openjdk.java.net/projects/jdk/14/以下是个人对于特性的中文式...

爬虫(101)爬点重口味的

小弟最近在学校无聊的很哪,浏览网页突然看到一张图片,都快流鼻血。。。然后小弟冥思苦想,得干一点有趣的事情python 爬虫库安装https://s.taobao.com/api?_ks...

疫情后北上广深租房价格跌了吗? | Alfred数据室

去年3月份我们发布了《北上广深租房图鉴》(点击阅读),细数了北上广深租房的各种因素对租房价格的影响。一年过去了,在面临新冠疫情的后续影响、城市尚未完全恢复正常运转、学校还没开学等情况下...

面试官给我挖坑:a[i][j] 和 a[j][i] 有什么区别?

点击上方“朱小厮的博客”,选择“设为星标”后台回复&#34;1024&#34;领取公众号专属资料本文以一个简单的程序开头——数组赋值:int LEN = 10000; int[][] ...

又一起程序员被抓事件

就在昨天互联网又发生一起让人心酸的程序员犯罪事件,著名的百度不限速下载软件 Pandownload PC 版作者被警方抓获。案件大致是这样的:软件的作者不仅非法盗取用户数据,还在QQ群进...

应聘3万的职位,有必要这么刁难我么。。。沙雕。。。

又一次被面试官带到坑里面了。面试官:springmvc用过么?我:用过啊,经常用呢面试官:springmvc中为什么需要用父子容器?我:嗯。。。没听明白你说的什么。面试官:就是contr...

太狠了,疫情期间面试,一个问题砍了我5000!

疫情期间找工作确实有点难度,想拿到满意的薪资,确实要点实力啊!面试官:Spring中的@Value用过么,介绍一下我:@Value可以标注在字段上面,可以将外部配置文件中的数据,比如可以...

Intellij IDEA 美化指南

经常有人问我,你的 IDEA 配色哪里搞的,我会告诉他我自己改的。作为生产力工具,不但要顺手而且更要顺眼。这样才能快乐编码,甚至降低 BUG 率。上次分享了一些 IDEA 有用的插件,反...

【相亲】96年程序员小哥第一次相亲,还没开始就结束了

颜值有点高,条件有点好

太厉害了,终于有人能把TCP/IP 协议讲的明明白白了

一图看完本文 一、 计算机网络体系结构分层 计算机网络体系结构分层 计算机网络体系结构分层 不难看出,TCP/IP 与 OSI 在分层模块上稍有区别。OSI 参考模型注重“通信协议必要的功能是什么”,而 TCP/IP 则更强调“在计算机上实现协议应该开发哪种程序”。 二、 TCP/IP 基础 1. TCP/IP 的具体含义 从字面意义上讲,有人可能会认为...

腾讯面试题: 百度搜索为什么那么快?

我还记得去年面腾讯时,面试官最后一个问题是:百度/google的搜索为什么那么快? 这个问题我懵了,我从来没想过,搜素引擎的原理是什么 然后我回答:百度爬取了各个网站的信息,然后进行排序,当输入关键词的时候进行文档比对……巴拉巴拉 面试官:这不是我想要的答案 我内心 这个问题我一直耿耿于怀,终于今天,我把他写出来,以后再问,我直接把这篇文章甩给他!!! 两个字:倒排,将贯穿整篇文章,也是面试官...

相关热词 c# 按行txt c#怎么扫条形码 c#打包html c# 实现刷新数据 c# 两个自定义控件重叠 c#浮点类型计算 c#.net 中文乱码 c# 时间排序 c# 必备书籍 c#异步网络通信
立即提问