Skip to content

Commit 68626a7

Browse files
committed
fix: Use selector in favicon prop
1 parent 17def2a commit 68626a7

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Diff for: docs/guide/favicon.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Favicon
22

3-
| prop | Type | default
4-
| ----------- | --------- | ----------
5-
| `favicon` | Boolean | `true`
3+
| prop | Type | default | Description
4+
| ----------- | ----------------------- | --------------------- | ------------------------
5+
| `favicon` | `String` \| `Boolean` | `link[rel="icon"]` | You can define the selector of the desired favicon (e.g. `#favicon`) or to disable this functionality, just by setting it to `false`.
66

77
You can switch the favicon according to the `prefers-color-scheme`.
88

Diff for: src/DarkMode.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ export default {
6262
default: '%cm color mode is enabled'
6363
},
6464
favicon: {
65-
type: Boolean,
66-
default: true
65+
type: [String, Boolean],
66+
default: 'link[rel="icon"]'
6767
}
6868
},
6969
@@ -162,7 +162,7 @@ export default {
162162
toggleFavicon (mode) {
163163
if (!this.favicon) return
164164
this.$nextTick(() => {
165-
const favicon = document.querySelector('link[rel="icon"]')
165+
const favicon = document.querySelector(this.favicon)
166166
if (!favicon) return
167167
const href = favicon.getAttribute('href')
168168
const lastFour = href.substr(-4, 4)

0 commit comments

Comments
 (0)