2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Laravel5.8で導入したvuejs-paginateのデザインが反映されない問題

Last updated at Posted at 2019-06-14

環境と経緯

Laravel + Vueのアプリケーションでページネーション機能が欲しかったので、vuejs-paginateを導入したが、公式通りに導入してもなぜかデザインが反映されない

症状と原因

本来なってほしいデザイン

See the Pen vuejs-paginate with bs3 by うぃむ@謳って⤴謳って⤴雲の上ぇぇええ☁🥰 (@wim_web) on CodePen.

おかしいデザイン

See the Pen vuejs-paginate with bs4 by うぃむ@謳って⤴謳って⤴雲の上ぇぇええ☁🥰 (@wim_web) on CodePen.

コードをみてもらえれば分かるのですが、どちらのコードも全く同じです。
ではなにが違うのかというとBootstrapのバージョンです。
デザインがきちんと反映されているほうが3系で、反映されていないほうが4系です。
ReadMeでBootstrapについて特に言及されていなかったので原因がわかるまで時間がかかりました。。。

改善コード

paginateコンポーネントにCSSのクラスの情報を追加してあげる。

<paginate 
  :pageCount="10"
  :containerClass="'pagination'"
  :page-class="'page-item'"
  :page-link-class="'page-link'"
  :prev-class="'page-item'"
  :prev-link-class="'page-link'"
  :next-class="'page-item'"
  :next-link-class="'page-link'"
  :clickHandler="clickCallback">
 </paginate>

codepenで試してみてね!

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?