reactjs 无法向右移动项目符号

6tqwzwtp  于 2023-10-17  发布在  React
关注(0)|答案(1)|浏览(121)

我不能把要点移到右边一点。以下是我试图向右移动的要点:

{
                text: [
                    { text: 'Plan of care:', bold: true },
                    { text: noteData.planOfCare.map(plan => `\n     • ${plan}`), bold: false, margin: [20, 0, 0, 0] },
                ],
                margin: [0, 20, 0, 0]
            },

这里是父代码::

// util.pdf.pdf-templates.CriticalCareNurseReport.js

const RIGHT_MARGIN = 20;

export const criticalCareNurseReport = (noteData) => {
    return {
        header: {
            text: 'Critical Care Nurse',
            alignment: 'start',
            bold: true
        },
        content: [
            {
                text: [
                    { text: 'Date: ', bold: true },
                    { text: noteData.date, bold: false },
                ],
                margin: [0, 20, 0, 0]
            },

            {
                text: [
                    { text: 'Patient Name: ', bold: true },
                    { text: noteData.patientName, bold: false },
                ],
                margin: [0, 20, 0, 0]
            },
            {
                text: [
                    { text: 'Date of birth: ', bold: true },
                    { text: noteData.patientDateOfBirth, bold: false },
                ],
                margin: [0, 20, 0, 0]
            },
            {
                text: [
                    { text: 'Chief Complaint: ', bold: true },
                    { text: noteData.chiefComplaint, bold: false },
                ],
                margin: [0, 20, 0, 0]
            },
            {
                text: [
                    { text: 'Records Reviewed: ', bold: true },
                    { text: noteData.recordsReview, bold: false },
                ],
                margin: [0, 20, 0, 0]
            },
            {
                text: [
                    { text: 'Past medical history:', bold: true },
                    { text: noteData.pastMedicalHistory.map(plan => `\n• ${plan}`), bold: false },
                ],
                margin: [0, 20, 0, 0]
            },

            {
                text: [
                    { text: 'Social history:', bold: true },
                    { text: noteData.socialHistory.map(plan => `\n• ${plan}`), bold: false },
                ],
                margin: [0, 20, 0, 0]
            },
            {
                text: [
                    { text: 'Family Past Medical History:', bold: true },
                    { text: noteData.familyPastMedicalHistory.map(plan => `\n• ${plan}`), bold: false },
                ],
                margin: [0, 20, 0, 0]
            },

            {
                text: [
                    { text: 'Medications:', bold: true },
                    { text: noteData.medications.map(plan => `\n• ${plan}`), bold: false },
                ],
                margin: [0, 20, 0, 0]
            },
            {
                text: [
                    { text: 'Plan of care:', bold: true },
                    { text: noteData.planOfCare.map(plan => `\n     • ${plan}`), bold: false, margin: [100, 0, 0, 0] },
                ],
                margin: [0, 20, 0, 0]
            },
            
            'Thank you for allowing us to advocate on your behalf.',
            {
                text: [
                    { text: `${noteData.user},  ${noteData.advocate}, ${noteData.degree},`, bold: false },
                ],
                margin: [0, 20, 0, 0]
            },

        ],

    };
};

我试图在开始时添加空格,但它不起作用。我试着增加利润率,但它也不起作用。以下是PDF现在的样子:

8dtrkrch

8dtrkrch1#

{
  text: [
    { text: "Plan of care:", bold: true },
    {
      ul: noteData.planOfCare.map((plan) => ({
        text: plan,
        margin: [20, 0, 0, 0],
      })),
      bold: false,
    },
  ],
  margin: [0, 20, 0, 0],
};

我已经使用ul属性为项目符号创建了一个无序列表。每个项目符号现在都是具有text和margin属性的对象。
通过将margin属性设置为[20,0,0,0],您将为每个项目符号点添加20个单位的左边距,有效地将它们向右移动。

相关问题