import React from 'react';
import { Helmet } from 'umi';
const Application = () => {
return (
<div className="application">
<Helmet>
<meta charSet="utf-8" />
<title>My Title</title>
<link rel="canonical" href="http://mysite.com/example" />
</Helmet>
</div>
);
}
export default Application;
import React, { useState, useEffect } from 'react';
import { Helmet } from 'umi';
import { getLogo } from '@/api/system';
const [helmetConfig, setHelmetConfig] = useState({
title: '',
image: ''
});
useEffect(() => {
getLogo().then((res) => {
localStorage.setItem('title', res.data.title);
localStorage.setItem('image', res.data.image);
setHelmetConfig({
title: res.data.title,
image: res.data.image
})
});
}, []);
return (
<>
<Helmet encodeSpecialCharacters={false}>
<title>{helmetConfig.title}</title>
<link rel="shortcut icon" href={`data:image/png;base64,${helmetConfig.image}`} />
</Helmet>
....其他的代码
</>
}
<link rel="shortcut icon" href={helmetConfig.image} />
iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA...省略
// 文本数据
data: text/plain,
// HTML代码
data: text/html,
// base64编码的HTML代码
data: text/html;base64,
// CSS代码
data: text/css,
// base64编码的CSS代码
data: text/css;base64,
// Javascript代码
data: text/javascript,
// base64编码的Javascript代码
data: text/javascript;base64,
// base64编码的gif图片数据
data: image/gif;base64,
// base64编码的png图片数据
data: image/png;base64,
// base64编码的jpeg图片数据
data: image/jpeg;base64,
// base64编码的icon图片数据
data: image/x-icon;base64,
import { defineConfig } from 'umi';
......
export default defineConfig({
title: false,
favicon: false,
......
});
<Helmet encodeSpecialCharacters={false}>
<title>This is a <title> tag</title>
</Helmet>
import React, { useState, useEffect } from 'react';
import { Helmet } from 'umi';
import { getLogo } from '@/api/system';
export default function (props) {
const [helmetConfig, setHelmetConfig] = useState({
title: '',
image: ''
});
useEffect(() => {
getLogo().then((res) => {
localStorage.setItem('title', res.data.title);
localStorage.setItem('image', res.data.image);
setHelmetConfig({
title: res.data.title,
image: res.data.image
})
});
}, []);
return (
<>
<Helmet encodeSpecialCharacters={false}>
<title>{helmetConfig.title}</title>
<link rel="shortcut icon" href={`data:image/png;base64,${helmetConfig.image}`} />
</Helmet>
...其他代码
</>
);
}
此页面不支持夜间模式!
已进入夜间模式!
已进入普通模式!
搜索框不允许为空
签到成功!经验+5!芋圆币+2!
签到失败!今日已签到!
需要登录社区账号才可以进入!