我使用 vue create project-name 初始化了新的vue.js项目 打开“网络”选项卡时,尽管页面和系统上没有任何更改,但我看到系统连续(如此快)发送请求。
我检查了我之前创建的其他vue.js项目,没有这种情况。为什么会这样,这是否有害?
https://www.photobox.co.uk/my/photo/full?photo_id=501507732068
(我无法添加此图像,如果您进行编辑,我将不胜感激)
edit:另外我还意识到,当我更改某些内容时,通常vue会立即进行自我更新。现在没有。刷新页面后,可以看到更改。
edit2:我尝试创建2个vue.js项目。您可以看到package.json文件。
{
"name": "client",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"axios": "^0.18.0",
"vue": "^2.5.17",
"vue-router": "^3.0.1",
"vuex": "^3.0.1"
},
"devDependencies": {
"@vue/cli-service": "^3.2.0",
"vue-template-compiler": "^2.5.17"
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
{
"name": "my-project",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"vue": "^2.5.17"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.2.0",
"@vue/cli-plugin-eslint": "^3.2.0",
"@vue/cli-service": "^3.2.0",
"babel-eslint": "^10.0.1",
"eslint": "^5.8.0",
"eslint-plugin-vue": "^5.0.0-0",
"vue-template-compiler": "^2.5.17"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
}
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
答案 0 :(得分:0)
如果它是一个websocket,那就不奇怪了。它将每X毫秒连续轮询一次。如果使用socket.io
之类的库,您将看到相同的行为。这是一种轮询架构。