feat(theme-color): toggle theme color along with dark mode using useHead (#20)

* feat(theme-color): toggle theme color along with dark mode

* feat(theme-color): toggle theme color along with dark mode using useHead

Co-authored-by: bryce <1907004005@gmail.com>
This commit is contained in:
guygubaby
2022-04-25 00:00:11 +08:00
committed by GitHub
parent 0dd3373bc2
commit 1e8905275b
2 changed files with 9 additions and 2 deletions

View File

@@ -7,7 +7,6 @@
<link rel="apple-touch-icon" href="/pwa-192x192.png"> <link rel="apple-touch-icon" href="/pwa-192x192.png">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#00aba9"> <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#00aba9">
<meta name="msapplication-TileColor" content="#00aba9"> <meta name="msapplication-TileColor" content="#00aba9">
<meta name="theme-color" content="#ffffff">
<meta name="description" content="好的,今天我们来做菜!"> <meta name="description" content="好的,今天我们来做菜!">
<title>隔离食用手册</title> <title>隔离食用手册</title>
<script> <script>

View File

@@ -1,11 +1,19 @@
<script setup lang="ts"> <script setup lang="ts">
import { isDark } from '~/composables'
// https://github.com/vueuse/head // https://github.com/vueuse/head
// you can use this to manipulate the document head in any components, // you can use this to manipulate the document head in any components,
// they will be rendered correctly in the html results with vite-ssg // they will be rendered correctly in the html results with vite-ssg
useHead({ useHead({
title: '隔离食用手册', title: '隔离食用手册',
meta: [ meta: [
{ name: 'description', content: '好的,今天我们来做菜!' }, {
name: 'description',
content: '好的,今天我们来做菜!',
},
{
name: 'theme-color',
content: computed(() => isDark.value ? '#121212' : '#fff'),
},
], ],
}) })
</script> </script>