Yii2在网格视图中显示行号

I want to show row number in my grid view but I can't not find a way to do this.

I found this question Get the absolute row number in a grid but it seems to be geared towards Yii1.

This is what my grid view looks like

<?php Pjax::begin(['id' => 'leaderboard-pjax']); ?>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            'username',
            'total',
        ],
        'summary'=>'',
    ]); ?>
<?php Pjax::end(); ?>

and my data provider

$dataProvider = new ActiveDataProvider([
        'query' => (new \yii\db\Query())
            ->select('user.username, score.total')
            ->from('user')
            ->leftJoin('score', 'score.user_id = user.id')
            ->where(['user.role' => User::ROLE_USER])
            ->orderBy('total DESC'),
        'pagination' => [
            'pageSize' => 10,
        ],
    ]);

You need ['class' => 'yii\grid\SerialColumn'],

<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'columns' => [
        ['class' => 'yii\grid\SerialColumn'],
        'username',
        'total',
    ],
    'summary'=>'',
]); ?>