我对 yahoo/react-intl 有一个问题,我想以字符串类型制作消息,但是当我使用 FormattedMessage 时,它给了我用 span 包裹的消息,这并不酷。我试过 formatMessage ,但也不起作用。我非常感谢任何帮助或建议这是我的代码:
import React from 'react';
import {FormattedMessage} from 'react-intl';
export default {
items: [
{
name: <FormattedMessage id='app.dashboard'/>,
url: '/dashboard',
icon: 'icon-speedometer',
badge: {
variant: 'info',
text: 'New',
},
},
{
title: true,
name: <FormattedMessage id='app.dashboard'/>,
// optional wrapper object
wrapper: {
// required valid HTML5 element tag
element: 'strong',
// optional valid JS object with JS API naming ex: { className: "my-class", style: { fontFamily: "Verdana" }, id: "my-id"}
attributes: {}, …Run Code Online (Sandbox Code Playgroud)