小编Ham*_*van的帖子

如何在react-intl中不包裹跨度的情况下制作消息

我对 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)

formatmessage reactjs react-intl

3
推荐指数
2
解决办法
3398
查看次数

标签 统计

formatmessage ×1

react-intl ×1

reactjs ×1