{"id":25254220,"url":"https://github.com/alchemycms/alchemy-vue","last_synced_at":"2025-07-11T05:35:13.673Z","repository":{"id":47722578,"uuid":"309799685","full_name":"AlchemyCMS/alchemy-vue","owner":"AlchemyCMS","description":"AlchemyCMS Mixins for VueJs","archived":false,"fork":false,"pushed_at":"2023-05-17T08:18:05.000Z","size":174,"stargazers_count":4,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-12-14T18:40:40.886Z","etag":null,"topics":["alchemy-cms","headless-cms","vuejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlchemyCMS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2020-11-03T20:29:00.000Z","updated_at":"2024-04-10T17:26:37.000Z","dependencies_parsed_at":"2024-01-30T03:03:28.369Z","dependency_job_id":"a3bac71e-cca8-477a-bd54-792afae6cef3","html_url":"https://github.com/AlchemyCMS/alchemy-vue","commit_stats":{"total_commits":33,"total_committers":2,"mean_commits":16.5,"dds":0.06060606060606055,"last_synced_commit":"99d38ad38943238168b6aae73db18f6aae4f761c"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlchemyCMS%2Falchemy-vue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlchemyCMS%2Falchemy-vue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlchemyCMS%2Falchemy-vue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlchemyCMS%2Falchemy-vue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlchemyCMS","download_url":"https://codeload.github.com/AlchemyCMS/alchemy-vue/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238418213,"owners_count":19468865,"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":["alchemy-cms","headless-cms","vuejs"],"created_at":"2025-02-12T05:31:20.711Z","updated_at":"2025-02-12T05:31:32.880Z","avatar_url":"https://github.com/AlchemyCMS.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AlchemyCMS mixins for VueJS\n\n[![Build Status](https://travis-ci.com/AlchemyCMS/alchemy-vue.svg?branch=main)](https://travis-ci.com/AlchemyCMS/alchemy-vue)\n[![npm version](https://badge.fury.io/js/%40alchemy_cms%2Fvue.svg)](https://badge.fury.io/js/%40alchemy_cms%2Fvue)\n\n[VueJS](https://vuejs.org) mixins for rendering content from [AlchemyCMS](https://alchemy-cms.com)\n\n## Install\n\n```\nyarn add @alchemy_cms/vue\n```\n\n## Usage\n\n### In a page component\n\n```js\nimport { AlchemyPage } from \"@alchemy_cms/vue\"\n\nexport default {\n  mixins: [AlchemyPage],\n}\n```\n\nYou now have acces to the `page` prop and its `elements`. Also you have access to the `componentName()` method that you can use to dynamically render element components.\n\n```html\n\u003ctemplate\u003e\n  \u003cdiv :class=\"page.page_layout\"\u003e\n    \u003ccomponent\n      :is=\"componentName(element)\"\n      v-for=\"element in page.elements\"\n      :key=\"element.id\"\n      :element=\"element\"\n    /\u003e\n  \u003c/div\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\n  import { AlchemyPage } from \"@alchemy_cms/vue\"\n  import MainHeader from \"~/alchemy/elements/main_header\"\n  import TextBlock from \"~/alchemy/elements/text_block\"\n\n  export default {\n    components: {\n      main_header: MainHeader,\n      text_block: TextBlock,\n    },\n    mixins: [AlchemyPage],\n  }\n\u003c/script\u003e\n```\n\n_**Note** you need to pass the data into the components `page` prop either by fetching it from the Alchemy API or by erb interpolation._\n\n### In an element component\n\n```js\nimport { AlchemyElement } from \"@alchemy_cms/vue\"\n\nexport default {\n  mixins: [AlchemyElement],\n}\n```\n\nWith this mixin you have acces to the `element` prop and its `ingredients`.\n\nAlso you have access to the `getIngredient()` and `getEssence()` methods that you can use to pass content from Alchemy objects into your components props.\n\n```html\n\u003ctemplate\u003e\n  \u003cContainer\u003e\n    \u003cImage :src=\"imageUrl\" :alt=\"imageAlt\" /\u003e\n    \u003cParagraph class=\"text\" v-html=\"text\" /\u003e\n  \u003c/Container\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\n  import { AlchemyElement } from \"@alchemy_cms/vue\"\n  import Container from \"~/components/Container\"\n  import Image from \"~/components/Image\"\n  import Paragraph from \"~/components/Paragraph\"\n\n  export default {\n    components: { Container, Image, Paragraph },\n    mixins: [AlchemyElement],\n    computed: {\n      imageUrl() {\n        return this.getIngredient(\"picture\")\n      },\n      altText() {\n        return this.getEssence(\"picture\")?.alt_text\n      },\n      text() {\n        return this.getIngredient(\"text\")\n      },\n    },\n  }\n\u003c/script\u003e\n```\n\n_**Note** you need to pass the data into the components `element` prop either by fetching it from the Alchemy API, by passing it from a page component (see example above) or by erb interpolation._\n\n### `camelCase` attributes\n\nThis package supports `camelCase` attributes as well was `under_score` attributes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falchemycms%2Falchemy-vue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falchemycms%2Falchemy-vue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falchemycms%2Falchemy-vue/lists"}