新手在线求助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:9999 连接不成功是为什么

eclipse下面这段代码运行后,win7浏览器输入 http://localhost:9999连接失败。 而且更改端口也不行。请问大家是什么原因。 import java.io.*; import java.net.*; public class Server { public static void main(String[] args) throws IOException { ServerSocket server; Socket sock; FileInputStream in; OutputStream out; server = new ServerSocket(9999); sock = server.accept(); in = new FileInputStream("c:\\1.html"); out = sock.getOutputStream(); int len = 0; byte[] buffer = new byte[1024]; while ((len = in.read(buffer)) > 0) { out.write(buffer, 0, len); } out.close(); in.close(); sock.close(); server.close(); } }

与“ws:// localhost:8080 /”的WebSocket连接失败:这个报错是怎么回事?

我的客户端脚本和服务器之间没有WebSocket连接,它在我当前的环境中运行得很好。同时,我也遵循这个<a href="http://socketo.me/docs/push" rel="nofollow noreferrer">链接</a>。 下面是一个服务器脚本,它初始化WebSocket服务器并让客户端连接到了8080端口。</p> <pre><code>public function run() { $loop = Factory::create(); $pusher = new Pusher; $context = new Context($loop); $pull = $context-&gt;getSocket(ZMQ::SOCKET_PULL); $pull-&gt;bind('tcp://127.0.0.1:5555'); // Binding to 127.0.0.1 means the only client that can connect is itself $pull-&gt;on('message', array($pusher, 'onBlogEntry')); // Set up our WebSocket server for clients wanting real-time updates $webSock = new Server('0.0.0.0:8080', $loop); // Binding to 0.0.0.0 means remotes can connect $webServer = new IoServer( new HttpServer( new WsServer( new WampServer( $pusher ) ) ), $webSock ); $loop-&gt;run(); </code></pre> <p>这是客户端脚本:</p> <pre><code>var conn = new ab.Session('ws://localhost:8080', function() { /* subscribe to following topics */ conn.subscribe('new_order', function(topic, data) .. </code></pre> <p>同样,这在本地设置中运行良好。</p> <p>还要注意的是,我的应用程序是使用来自docker容器的指定端口承载的。</p> <pre><code>http://192.168.12.52:8094/xyz/new/.... </code></pre> <p>我还尝试在客户端脚本中指定IP:</p> <pre><code>var conn = new ab.Session('ws://192.168.12.52:8080', function() { /* subscribe to following topics */ conn.subscribe('new_order', function(topic, data) ... </code></pre> <p>在这种情况下,我会得到以下错误:</p> <pre><code>WebSocket connection to 'ws://192.168.11.32:8080/' failed: Error during WebSocket handshake: Unexpected response code: 403 </code></pre> <p>这里缺少什么?</p> </div>

无法从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>

初始化的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 ```

跨源请求已阻止:同源策略禁止读取远程资源不起作用

<div class="post-text" itemprop="text"> <p>I'm new to Laravel and have gone through several solutions on tackoverflow, but to no avail. It's still showing the same error of Cross-Origin Request Blocked.</p> <pre><code>$(".cmd_submit").click(function(){ $.ajax({ //crossOrigin: true, //header:{'Access-Control-Allow-Origin': '*'}, type: 'POST', url: 'http://localhost/members/register', data: $('#form_reg').serialize(), success: function(data){ alert(data); }, error: function(data){ alert(data); } </code></pre> <p>I also included this:</p> <pre><code>&lt;?php header("Access-Control-Allow-Origin: *"); ?&gt; </code></pre> <p>on my app.blade.php, but it still didn't work.</p> </div>

未捕获的DOMException:无法在'Element'上执行'setAttribute':'1'不是Laravel刀片模板中的有效属性名称

<div class="post-text" itemprop="text"> <p>I have a problem in my code, it is functional and but it bugs me with the console error I am getting from chrome.</p> <p>My blade template code is:</p> <pre><code>&lt;select name="business_unit_id" class="form-control"&gt; @foreach (App\Models\BusinessUnit::all() as $data) &lt;option value="{{ $data-&gt;id }}" {{ old('business_unit_id', $cost_centers-&gt;business_unit_id ?? null) != $data-&gt;id ?: 'selected' }}&gt; {{ $data-&gt;code.' - '.$data-&gt;descr }} &lt;/option&gt; @endforeach &lt;/select&gt; </code></pre> <p>The console error are:</p> <pre><code>app.js:41637 Uncaught DOMException: Failed to execute 'setAttribute' on 'Element': '1' is not a valid attribute name. at baseSetAttr (http://ksakuws1137/js/app.js:43932:8) at setAttr (http://ksakuws1137/js/app.js:43907:5) at Array.updateAttrs (http://ksakuws1137/js/app.js:43862:7) at invokeCreateHooks (http://ksakuws1137/js/app.js:43218:22) at createElm (http://ksakuws1137/js/app.js:43105:11) at createChildren (http://ksakuws1137/js/app.js:43202:9) at createElm (http://ksakuws1137/js/app.js:43103:9) at createChildren (http://ksakuws1137/js/app.js:43202:9) at createElm (http://ksakuws1137/js/app.js:43103:9) at createChildren (http://ksakuws1137/js/app.js:43202:9) </code></pre> <p>The culprit is below, but that is needed to in order for the program to behave correctly. </p> <pre><code>{{ old('business_unit_id', $cost_centers-&gt;business_unit_id ?? null) != $data-&gt;id ?: 'selected' }}&gt; </code></pre> <p>Anyone encounter the same issue and have a resolution? Thanks.</p> </div>

求助:Laravel来自源的XMLHttpRequest访问已被CORS策略阻止?

<div class="post-text" itemprop="text"> <p>当我从Angular给Laravel发送需求时,我得到了这个:</p> <pre><code>Access to XMLHttpRequest at 'http://localhost:8083/api/login_otp' from origin 'http://localhost:4200' has been blocked by CORS policy: Request header field ip is not allowed by Access-Control-Allow-Headers in preflight response. </code></pre> <p>我找到了一个解决方案,并在CROS.php中做了以下更改:</p> <pre><code>public function handle($request, Closure $next) { return $next($request) -&gt;header('Access-Control-Allow-Origin', '*') -&gt;header('Access-Control-Allow-Methods', 'GET, POST, PATCH, PUT, DELETE, OPTIONS') -&gt;header('Access-Control-Allow-Headers', 'Origin, Content-Type, X-Auth-Token, Authorization, X-Requested-With, x-xsrf-token'); } </code></pre> <p>我在访问控制允许标头中添加了x-xsrf-Token,但我还是遇到了同样的问题。</p> </div>

create-react-app 与 firebase 项目设置了proxy还报错[HPM] Error occurred while trying to proxy request / from localhost:3000 to https://asia-east2-socialape-d6344.cloudfunctions.net/api (ETIMEDOUT)

服务端使用的是firebase,接口数据也都有, 前端代理也设置了, 由于访问的是https 在package.json的start处也设置了set HTTPS=true 但还是报错 ``` Error occurred while trying to proxy request / from localhost:3000 to https://asia-east2-socialape-d6344.cloudfunctions.net/api (ETIMEDOUT) (https://nodejs.org/api/errors.html#errors_common_system_errors) ``` ![这是接口信息](https://img-ask.csdn.net/upload/202004/18/1587175630_27678.png) ![按照create-react-app官网设置的代理](https://img-ask.csdn.net/upload/202004/18/1587175673_798700.png) ![图片说明](https://img-ask.csdn.net/upload/202004/18/1587175718_245032.png) 又遇到过这个问题的么,我看问题的描述是在进行代理的过程中发生的错误,不知道怎么解决了, 谢谢!!!

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/...

cors(cors policy:对预检请求的响应未通过访问控制检查)角度7中的错误

<div class="post-text" itemprop="text"> <p>Access to XMLHttpRequest at '<a href="http://192.168.1.30/v1w/?tag=login" rel="nofollow noreferrer">http://192.168.1.30/v1w/?tag=login</a>' from origin '<a href="http://localhost:4200" rel="nofollow noreferrer">http://localhost:4200</a>' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.</p> </div>

问题:mac系统下localhost能打开,但localhost/xxx.php打不开

最近在学习 PHP,搭建环境后,在 Safari 能打开 http://localhost,显示 It works! 接着改动了 DocumentRoot 的地址为 Sites 文件的地址(“/Users/用户名/Sites”),让后创建新 php 文件,能在 Safari 中通过 http://localhost/xxx.php 可后来就不能打开了,只能打开 http://localhost,显示 It works! 这是怎么回事?是哪里配置出错了吗?

vue里将网址作为变量保存在全局中,组件里img标签中的src属性中怎么使用这个变量呢?

//main.js定义全局变量IP Vue.prototype.IP='http://192.168.1.187:3000' //原来的页面代码(能显示) img src='http://192.168.1.187:3000/img/index/TB2XapXsqmWBuNjy1XaXXXCbXXa-2247726430.jpg' alt="" //怎么将http://192.168.1.187:3000换成IP,我尝试过的方法如下,都不行 img :src="IP/img/index/TB2Ob7ytuySBuNjy1zdXXXPxFXa-2247726430.jpg" img :src=“IP+‘’/img/index/TB2Ob7ytuySBuNjy1zdXXXPxFXa-2247726430.jpg”

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

String s = new String(" a ") 到底产生几个对象?

老生常谈的一个梗,到2020了还在争论,你们一天天的,哎哎哎,我不是针对你一个,我是说在座的各位都是人才! 上图红色的这3个箭头,对于通过new产生一个字符串(”宜春”)时,会先去常量池中查找是否已经有了”宜春”对象,如果没有则在常量池中创建一个此字符串对象,然后堆中再创建一个常量池中此”宜春”对象的拷贝对象。 也就是说准确答案是产生了一个或两个对象,如果常量池中原来没有 ”宜春” ,就是两个。...

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

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

Linux面试题(2020最新版)

文章目录Linux 概述什么是LinuxUnix和Linux有什么区别?什么是 Linux 内核?Linux的基本组件是什么?Linux 的体系结构BASH和DOS之间的基本区别是什么?Linux 开机启动过程?Linux系统缺省的运行级别?Linux 使用的进程间通信方式?Linux 有哪些系统日志文件?Linux系统安装多个桌面环境有帮助吗?什么是交换空间?什么是root帐户什么是LILO?什...

将一个接口响应时间从2s优化到 200ms以内的一个案例

一、背景 在开发联调阶段发现一个接口的响应时间特别长,经常超时,囧… 本文讲讲是如何定位到性能瓶颈以及修改的思路,将该接口从 2 s 左右优化到 200ms 以内 。 二、步骤 2.1 定位 定位性能瓶颈有两个思路,一个是通过工具去监控,一个是通过经验去猜想。 2.1.1 工具监控 就工具而言,推荐使用 arthas ,用到的是 trace 命令 具体安装步骤很简单,大家自行研究。 我的使用步骤是...

学历低,无法胜任工作,大佬告诉你应该怎么做

微信上收到一位读者小涛的留言,大致的意思是自己只有高中学历,经过培训后找到了一份工作,但很难胜任,考虑要不要辞职找一份他能力可以胜任的实习工作。下面是他留言的一部分内容: 二哥,我是 2016 年高中毕业的,考上了大学但没去成,主要是因为当时家里经济条件不太允许。 打工了三年后想学一门技术,就去培训了。培训的学校比较垃圾,现在非常后悔没去正规一点的机构培训。 去年 11 月份来北京找到了一份工...

JVM内存结构和Java内存模型别再傻傻分不清了

讲一讲什么是Java内存模型 Java内存模型虽说是一个老生常谈的问题 ,也是大厂面试中绕不过的,甚至初级面试也会问到。但是真正要理解起来,还是相当困难,主要这个东西看不见,摸不着。 这是一个比较开放的题目,面试官主要想考察的是对Java内存模型的了解到了什么程度了,然后根据回答进行进一步的提问 下面,我们就这个问题的回答列一下我们的思路 具体的思路如下: 说一说Java内存模型的缘由 简略辨析...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

Google 与微软的浏览器之争

浏览器再现“神仙打架”。整理 | 屠敏头图 | CSDN 下载自东方 IC出品 | CSDN(ID:CSDNnews)从 IE 到 Chrome,再从 Chrome 到 Edge,微软与...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

搜狗输入法也在挑战国人的智商!

故事总是一个接着一个到来...上周写完《鲁大师已经彻底沦为一款垃圾流氓软件!》这篇文章之后,鲁大师的市场工作人员就找到了我,希望把这篇文章删除掉。经过一番沟通我先把这篇文章从公号中删除了...

85后蒋凡:28岁实现财务自由、34岁成为阿里万亿电商帝国双掌门,他的人生底层逻辑是什么?...

蒋凡是何许人也? 2017年12月27日,在入职4年时间里,蒋凡开挂般坐上了淘宝总裁位置。 为此,时任阿里CEO张勇在任命书中力赞: 蒋凡加入阿里,始终保持创业者的冲劲,有敏锐的...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

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

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

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

什么时候跳槽,为什么离职,你想好了么?

都是出来打工的,多为自己着想

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

立即提问
相关内容推荐