Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/liangdiyuan/vue-image-url-error-loader


https://github.com/liangdiyuan/vue-image-url-error-loader

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

### 当图片出错时,统一为图片添加展示错误图片的路径。例子: onerror="this.src='error.png'"

```
const VueLoaderPlugin = require("vue-loader/lib/plugin");

/**
* @type {Configuration}
*/
const config = {
mode: "none",
entry: "./src/main.js",
output: {
filename: "bundle.js",
},
module: {
rules: [
{
test: /.vue$/,
use: [
"vue-loader",
{
loader: "./vue-image-url-error-loader",
options: { imageUrl: "erroe.png" },
},
],
},
{
test: /.css$/,
use: ["style-loader", "css-loader"],
},
],
},
plugins: [
new VueLoaderPlugin(),
],
};
module.exports = config;
```