Skip to content

Commit c99e0f9

Browse files
committed
feat: make background image configurable
1 parent c35e1c9 commit c99e0f9

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

packages/create-app/template/slides.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
theme: '@slidev/theme-seriph'
3+
background: 'https://images.unsplash.com/photo-1619191163166-07a53b7a8f30?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80'
34
---
45

56
# Welcome to Slidev

packages/theme-seriph/layouts/cover.vue

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
1+
<script setup lang="ts">
2+
import { defineProps, computed } from 'vue'
3+
4+
const props = defineProps({
5+
background: {
6+
default: 'https://images.unsplash.com/photo-1504275107627-0c2ba7a43dba?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=2167&q=80',
7+
},
8+
})
9+
10+
const style = computed(() => ({
11+
backgroundImage: `linear-gradient(#0005, #0008), url(${props.background})`,
12+
backgroundRepeat: 'no-repeat',
13+
backgroundPosition: 'center',
14+
backgroundSize: 'cover',
15+
}))
16+
</script>
17+
118
<template>
219
<div
320
class="layout-master cover text-white text-center"
4-
style="
5-
background-image: linear-gradient(#0005, #0008), url('https://images.unsplash.com/photo-1504275107627-0c2ba7a43dba?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=2167&q=80');
6-
background-repeat: no-repeat;
7-
background-position: center;
8-
background-size: cover;
9-
"
21+
:style="style"
1022
>
1123
<div class="my-auto w-full">
1224
<slot />

0 commit comments

Comments
 (0)