favicon跟随头像

This commit is contained in:
2023-10-05 12:25:55 +08:00
parent 1884fc6750
commit 0fb2bab1d0
2 changed files with 10 additions and 3 deletions

View File

@ -280,7 +280,7 @@ export default class ClientList {
},
value: item.name ?? item.id,
type: 'text',
placeholder: '请设置你的名字',
placeholder: '请设置你的昵称',
onchange: event => {
localStorage.setItem('username', event.target.value)
window.location.reload() // 简单刷新页面

View File

@ -228,17 +228,24 @@
// 延迟1500ms
//await new Promise((resolve) => setTimeout(resolve, 100))
// 设置自己的主机名
const nameInput = document.createElement('input')
nameInput.type = 'text'
nameInput.placeholder = '请设置你的名字'
nameInput.placeholder = '请设置你的昵称'
nameInput.value = name
nameInput.onchange = event => {
localStorage.setItem('username', event.target.value)
window.location.reload() // 简单刷新页面
}
document.body.appendChild(nameInput)
if (localStorage.getItem('avatar')) {
const favicon = document.createElement('link')
favicon.rel = 'icon'
favicon.href = localStorage.getItem('avatar')
document.head.appendChild(favicon)
}
</script>
</body>