{"id":27492123,"url":"https://github.com/en96321/vue-inheritance","last_synced_at":"2026-01-18T07:33:04.558Z","repository":{"id":212033515,"uuid":"730541841","full_name":"en96321/vue-inheritance","owner":"en96321","description":"vue-inheritance","archived":false,"fork":false,"pushed_at":"2024-09-25T03:34:36.000Z","size":97,"stargazers_count":17,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-09T18:45:48.718Z","etag":null,"topics":["extend","implement","inheritance","vue","vue3"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/vue-inheritance","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/en96321.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-12-12T06:36:38.000Z","updated_at":"2025-04-13T19:55:47.000Z","dependencies_parsed_at":"2025-04-16T23:09:11.045Z","dependency_job_id":"2435ae27-827d-4399-85eb-212a3d84705a","html_url":"https://github.com/en96321/vue-inheritance","commit_stats":null,"previous_names":["en96321/vue-inheritance"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/en96321/vue-inheritance","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/en96321%2Fvue-inheritance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/en96321%2Fvue-inheritance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/en96321%2Fvue-inheritance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/en96321%2Fvue-inheritance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/en96321","download_url":"https://codeload.github.com/en96321/vue-inheritance/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/en96321%2Fvue-inheritance/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28533168,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["extend","implement","inheritance","vue","vue3"],"created_at":"2025-04-16T23:02:37.617Z","updated_at":"2026-01-18T07:32:59.540Z","avatar_url":"https://github.com/en96321.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Vue Inheritance\n\n### Introduction\n\nvue-inheritance is an npm package designed for Vue.js projects. It provides a convenient way to manage and reuse component properties and methods. Leveraging Vue's extension and mixin capabilities, this package simplifies the definition and application of component attributes, making it more modular.\n\n**Installation**\n\ninstall vue-inheritance using the following command:\n\n```bash\nnpm install vue-inheritance\n```\n\n**Usage**\n\nIn your Vue project, import VueInheritance:\n\n```\nimport { VueInheritance } from 'vue-inheritance'\n```\n\n**Define Interface Modules**\n\nDefine one or more props, methods, computed modules.\n\n```javascript\n// IControl\nexport const IControl = {\n  props: {\n    disabled: {\n       type: Boolean,\n       default: false\n    }\n  }\n}\n\n// ITheme\nexport const ITheme = {\n  props: {\n    theme: {\n      type: String,\n      default: 'Standard'\n    }\n  }\n}\n\n// ILoading\nexport const ILoading = {\n  props: {\n    isLoading: {\n      type: Boolean,\n      default: false\n    }\n  }\n}\n\n\n// IButton \nexport const IButton = {\n  extends: VueInheritance.implement(IControl).implement(ITheme)\n  props: {\n    size: {\n      type: String,\n      default: 'lg'\n    }\n  },\n\n  methods: {\n  }\n}\n\n\n\n  \n```\n\n**Implement**\n\nIn your specific component, use the VueInheritance implement method to apply Interface modules.\n\n```javascript\n// Button.vue\nexport default {\n  extends: VueInheritance.implement(IControl).implement(ITheme),\n  methods: {\n    onClick(e) {\n      this.$emit('click', e)\n    }\n  }\n}\n\n// or\n\nexport default {\n  extends: IButton\n}\n```\n\n**Extend**\n\nIn another component, use the extend method to inherit an existing component and the implement method to apply additional attribute modules.\n\n```javascript\n// LoadingButton.vue\nimport Button from './Button.vue'\n\nexport default {\n  extends: VueInheritance.extend(Button).implement(ILoading)\n}\n```\n\n**Examples**\nButton with IControl and ITheme\n\n```vue\n\u003ctemplate\u003e\n   \u003cbutton :disabled=\"disabled\" :class=\"theme\" @click=\"onClick\"\u003eClick me\u003c/button\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\nimport { VueInheritance } from 'vue-inheritance'\nimport { IControl } from '@/core/IControl.js'\nimport { ITheme } from '@/core/ITheme.js'\n\nexport default {\n   extends: VueInheritance.implement(IControl).implement(ITheme),\n   methods: {\n      onClick(e) {\n         this.$emit('click', e)\n      }\n   }\n}\n\u003c/script\u003e\n```\n\nLoading Button with ILoading\n\n```vue\n\u003ctemplate\u003e\n   \u003cButton :disabled=\"disabled || isLoading\" :class=\"theme\" @click=\"onClick\"\u003e\n      \u003cspan v-if=\"isLoading\"\u003eLoading...\u003c/span\u003e\n      \u003cspan v-else\u003eClick me\u003c/span\u003e\n   \u003c/Button\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\nimport { VueInheritance } from 'vue-inheritance'\nimport Button from './Button.vue'\nimport { ILoading } from '@/core/ILoading.js'\n\nexport default {\n   extends: VueInheritance.extend(Button).implement(ILoading)\n}\n\u003c/script\u003e\n```\n\nThis way, you can define interface modules based on project requirements and flexibly apply and reuse them in your components.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fen96321%2Fvue-inheritance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fen96321%2Fvue-inheritance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fen96321%2Fvue-inheritance/lists"}