vue項目兼容ie瀏覽器
- 配置babel-polyfill
- 安裝依賴babel-polyfill:
npm install --save babel-polyfill
- 配置webpcak.base.conf.js: 將打包入口使用包裹
```JS
entry: {
app: ['babel-polyfill', './src/main.js']
},
```
- 在main.js文件配置:
import 'babel-polyfill' //放在最頂部,確保全面加載咖祭。
- 在webpack.base.conf.js配置依賴中有es6語法的依賴使用babel轉(zhuǎn)換:
{
test: /\.js$/,
loader: 'babel-loader',
include: [
resolve('src'),
resolve('test'),
resolve('static'),
resolve('node_modules/webpack-dev-server/client'),
resolve('node_modules/element-ui/src'),
resolve('node_modules/element-ui/packages'),
resolve('node_modules/easyscroll')
]
},
- 配置es6-promise:
- 安裝:
npm install es6-promise
- 在main.js中導(dǎo)入:
import 'es6-promise/auto'
- 在index.html中寫入:
<meta http-equiv="Cache-control" content="no-cache"> // 禁止瀏覽器緩存
<meta http-equiv="X-UA-Compatible" content="IE=10" > // 讓ie瀏覽器支持最高的兼容性,本項目在ie10下展示效果更佳蔫骂,因此寫的ie10