{"id":22051933,"url":"https://github.com/chenchenwuai/v-auth-image","last_synced_at":"2025-05-11T04:56:41.637Z","repository":{"id":46145191,"uuid":"264866148","full_name":"chenchenwuai/v-auth-image","owner":"chenchenwuai","description":"一个展示带权限图片的vue2指令，自定义请求header，使用原生请求方法，支持加载成功和失败回调，不依赖axios。","archived":false,"fork":false,"pushed_at":"2021-12-12T00:53:44.000Z","size":166,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-11T04:56:00.995Z","etag":null,"topics":["authentication","image","vue","vue-auth-image","vue-image"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chenchenwuai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-18T07:46:55.000Z","updated_at":"2022-03-21T12:31:33.000Z","dependencies_parsed_at":"2022-08-26T16:10:42.279Z","dependency_job_id":null,"html_url":"https://github.com/chenchenwuai/v-auth-image","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenchenwuai%2Fv-auth-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenchenwuai%2Fv-auth-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenchenwuai%2Fv-auth-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenchenwuai%2Fv-auth-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chenchenwuai","download_url":"https://codeload.github.com/chenchenwuai/v-auth-image/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253518967,"owners_count":21921083,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","image","vue","vue-auth-image","vue-image"],"created_at":"2024-11-30T15:12:21.935Z","updated_at":"2025-05-11T04:56:41.614Z","avatar_url":"https://github.com/chenchenwuai.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# v-auth-image\r\n一个显示有认证机制的图片的vue2指令\r\n\r\n## 特点\r\n  + 可自定义`header`字段，无限制数量\r\n  + 简单易用，结构简单，只有一个`v-auth-image`指令\r\n## 安装\r\n```bash\r\n  npm i v-auth-image\r\n```\r\n## 使用\r\n  ### 注册指令\r\n  ```js\r\n    import vAuthImage from 'v-auth-image'\r\n\r\n    Vue.use(vAuthImage,{\r\n      // 默认图片，还未加载图片显示。[可选]\r\n      defaultSRC:'default.logo',\r\n\r\n      /**\r\n      * 默认请求headers，[可选]，类似于 \r\n      * { Authorization: \"bearer xasdasdfasdfa\", 'x-token': \"x-token this is a x-token\" } 的对象\r\n      */\r\n      defaultHeaders:{\r\n        Authorization: \"bearer this is a authorization\"\r\n      },\r\n      \r\n      // 动态获取到的headers，会与 defaultHeaders 覆盖合并。[可选]\r\n      getHeaders: getHeaders \r\n    })\r\n    function getHeaders(){\r\n      return {\r\n        'x-token': \"x-token this is a x-token\",\r\n        Authorization: \"bearer this is a authorization2\"\r\n      }\r\n    }\r\n  ```\r\n  ### 使用指令 v-auth-image\r\n  ```html\r\n    \u003ctemplate\u003e\r\n      \u003cimg \r\n        v-auth-image=\"imgUrl\"\r\n        v-auth-image:success=\"imageLoadSuccess\"\r\n        v-auth-image:error=\"imageLoadError\"\r\n      \u003e\r\n    \u003c/template\u003e\r\n    \u003cscript\u003e\r\n      export default {\r\n        data () {\r\n          return {\r\n            imageUrl: 'http://xxx.xxx.png'\r\n          }\r\n        },\r\n        methods:{\r\n          imageLoadSuccess(e){\r\n            console.log('load success',e);\r\n          },\r\n          imageLoadError(e){\r\n            console.log('load error',e);\r\n          }\r\n        }\r\n      }\r\n    \u003c/script\u003e\r\n  ```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenchenwuai%2Fv-auth-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchenchenwuai%2Fv-auth-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenchenwuai%2Fv-auth-image/lists"}