索引和 CRUD 页面的布局是从右到左而不是在使用 Symfony 框架的 Easyadmin 中从左到右
The layout of the index and CRUD pages are from right to left instead of left to right in Easyadmin using Symfony framework
当我登录到easyadmin时,一切看起来都很正常。
example
但是一旦我刷新页面,一切看起来都像是在相反的方向上,它应该是这样的。
example
我的代码如下:
<?php
namespace App\Controller\Admin;
use App\Entity\Post;
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use EasyCorp\Bundle\EasyAdminBundle\Router\CrudUrlGenerator;
class DashboardController extends AbstractDashboardController
{
/**
* @Route("/admin", name="admin")
*/
public function index(): Response
{
$routeBuilder = $this->get(CrudUrlGenerator::class)->build();
return $this->redirect($routeBuilder->setController(PostCrudController::class)->generateUrl());
}
public function configureDashboard(): Dashboard
{
return Dashboard::new()
->setTitle('Dashboard');
}
public function configureMenuItems(): iterable
{
yield MenuItem::linkToCrud('Nieuws', 'far fa-newspaper', Post::class);
}
}
在 CRUD 页面中,同样的问题仍然存在。
提前致谢!
好的,所以我通过将 ->setTextDirection('ltr');
添加到 configureDashboard 来修复它,如下所示:
public function configureDashboard() : Dashboard
{
return Dashboard::new()
->setTitle('Dashboard')
->setTextDirection('ltr');
}
当我登录到easyadmin时,一切看起来都很正常。
example
但是一旦我刷新页面,一切看起来都像是在相反的方向上,它应该是这样的。
example
我的代码如下:
<?php
namespace App\Controller\Admin;
use App\Entity\Post;
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use EasyCorp\Bundle\EasyAdminBundle\Router\CrudUrlGenerator;
class DashboardController extends AbstractDashboardController
{
/**
* @Route("/admin", name="admin")
*/
public function index(): Response
{
$routeBuilder = $this->get(CrudUrlGenerator::class)->build();
return $this->redirect($routeBuilder->setController(PostCrudController::class)->generateUrl());
}
public function configureDashboard(): Dashboard
{
return Dashboard::new()
->setTitle('Dashboard');
}
public function configureMenuItems(): iterable
{
yield MenuItem::linkToCrud('Nieuws', 'far fa-newspaper', Post::class);
}
}
在 CRUD 页面中,同样的问题仍然存在。 提前致谢!
好的,所以我通过将 ->setTextDirection('ltr');
添加到 configureDashboard 来修复它,如下所示:
public function configureDashboard() : Dashboard
{
return Dashboard::new()
->setTitle('Dashboard')
->setTextDirection('ltr');
}