Have ideas to improve npm?Join in the discussion! »

    ofa-img-onerror
    TypeScript icon, indicating that this package has built-in type declarations

    0.2.0 • Public • Published

    img-onerror

    handle image tag error enent.

    Usage

    // main file
    const imgOnerror = require('ofa-img-onerror');
    // or
    // import imgOnerror from 'ofa-img-onerror';
     
     
    Vue.use(imgOnerror);
     
    // business files
     
    <img
        src="/error.png"
        v-imgOnerror="
            'https://raw.githubusercontent.com/FoxDaxian/FoxDaxian.github.io/master/assets/picgo/20191201163946.jpg'
        "
        alt="alt"
    />
     

    success demo

    like this below, img-onerror will add classname imgOnerror

    error demo

    like this below, img-onerror will add classname imgOnerror-error

    For to meet different business, you can custom style use different classname

    Install

    npm i ofa-img-onerror

    DownloadsWeekly Downloads

    5

    Version

    0.2.0

    License

    ISC

    Unpacked Size

    38.8 kB

    Total Files

    8

    Last publish

    Collaborators

    • avatar