A Vue.js project
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# clean dist
npm run clean
For detailed explanation on how things work, consult the docs for vue-loader.
axios.get("/static/item.json", {
params: {
id: 101
}
}).then(response=>{
console.log("method then 1", response);
//返回response
return response;
}).then(response=>{
console.log("method then 2", response);
//返回response
return response;
}).then(response=>{
console.log("method then 3", response);
//返回response
//return response;
}).then(response=>{
//上面没有返回response,这里的response就undefined
console.log("method then 4", response);
return response;
})
;E:\Program Files (x86)\Microsoft VS Code\bin
AppData\Roaming\npm\
# 安装 promise-polyfill
npm install promise-polyfill
# 把 node_modules/promise-polyfill/promise.min.js 移到 polyfill/目录中
# 页面添加 IE条件性注释
<![if IE]>
<script src="/polyfill/promise.min.js"></script>
<![endif]>
# 安装 es6-promise
npm install es6-promise
# main.js文件引入
import 'es6-promise/auto'
# webpack.config.js 配置
entry: {
app: './src/main.js',
// app: ['promise-polyfill', './src/main.js'],
vendor: [
'es6-promise/auto',
...
]
},
module: {
// noParse: /promise-polyfill\.js$/, // avoid webpack shimming process
noParse: /es6-promise\.js$/, // avoid webpack shimming process
...
}