-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUS-837] add html cms block and element (#52)
* [BUS-837] add html cms block and element * [BUS-837] code review changes
- Loading branch information
1 parent
e8a73f1
commit 872ff8b
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<script setup lang="ts"> | ||
import type { Schemas } from '@shopware/api-client/api-types'; | ||
const props = defineProps<{ | ||
block: Schemas['CmsBlock']; | ||
}>(); | ||
const { getSlotContent } = useCmsBlock(props.block); | ||
const content: Schemas['CmsSlot'] = getSlotContent('content'); | ||
</script> | ||
|
||
<template> | ||
<CmsLoader :content="content" /> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<script setup lang="ts"> | ||
import type { CmsElementText } from '@shopware-pwa/composables-next'; | ||
const props = defineProps<{ | ||
element: CmsElementText; | ||
}>(); | ||
const config = useCmsElementConfig(props.element); | ||
const content = config.getConfigValue('content'); | ||
</script> | ||
|
||
<template> | ||
<!-- v-html is necessary because we need to render html --> | ||
<!-- eslint-disable vue/no-v-html --> | ||
<div v-html="content" /> | ||
</template> |