Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 

Repository files navigation

Vue

1.解决vuecli打包后,css,js资源无法访问的问题

在项目的根目录添加vue.config.js文件,添加以下内容

module.exports = {
  publicPath: process.env.NODE_ENV === 'production'
    ? './' : '/'
}

2.忽略语法检查,vue.config.js+

lintOnSave: false,
    devServer: {
        overlay: {
            warning: false,
            errors: false
        }

    }

3.解决npm run build 报错

执行

cnpm install --global vue-cli
//报错信息
error code ELIFECYCLE
21 error errno 1
22 error [email protected] build: `vue-cli-service build`
22 error Exit status 1
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.

4.安装淘宝镜像

npm install -g cnpm --registry=https://registry.npm.taobao.org
npm install -g nrm
nrm ls
nrm use taobao

5.vuecli引入第三方图标

main.js里面导入

import './assets/iconfont/iconfont.js

App.vue加上style

.icon {
   width: 1em; height: 1em;
   vertical-align: -0.15em;
   fill: currentColor;
   overflow: hidden;
}

引用

<svg class="icon myIconStyle" aria-hidden="true">
  <use :xlink:href="'#' + dbIcon[item.type]"></use>
</svg>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors