调用变量内容

问题描述 投票:0回答:1

我正在使用一个名为 BankingWidgetSummary 的小部件

这里是一个使用的例子:

<BankingWidgetSummary
    title="Withdraws"
    color="warning"
    percent={-0.5}
    total={938}
    chart={{
        series: [111, 136, 76, 108, 74, 54, 57, 84],
    }}
    />

但是想使用变量中的图表系列

export const _bankingMovements = [
     {     
    id: _mock.id(1),     
    type: "Deposit",     
    series: 10,     
    },
    {    
    id: _mock.id(2),
    type: "Deposit", 
    series: 20, 
    }, 
    { 
    id: _mock.id(3), 
    type: "Withdraw", 
    series: 20, 
    }, 
    { 
    id: _mock.id(4), 
    type: "Deposit", 
    series: 30, 
    }, 
];

我是这样使用的,但显然有错误我找不到

<BankingWidgetSummary
    title="Deposits"
    percent={2.6}
    total={765}
    chart={_bankingMovements}
/>
reactjs variables
1个回答
0
投票
 const [bank, setBank] = useState([]);
 
 let _bankingMovements = {
             id: [ _mock.id(1), _mock.id(2), _mock.id(3), _mock.id(4)],
             datasets: { type: "Deposit", series: [10,20,30,40] }
         }
 
  setBank( _bankingMovements)
 
 <BankingWidgetSummary
     title="Deposits"
     percent='2.6'
     total='765'
     chart={bank}
 />
© www.soinside.com 2019 - 2024. All rights reserved.