semantic-ui_与Laravel和Semantic-UI一起使用的VueJS 2.x分页

semantic-ui

Laravel Vue语义UI分页 (Laravel Vue Semantic-UI Pagination)

A Vue.js pagination component for Laravel paginators that works with Semantic-UI.

一个适用于Laravel分页器的Vue.js分页组件,可与Semantic-UI一起使用。

This is on GitHub so let me know if I've b0rked it somewhere, give me a star star if you like it beers

这是在GitHub上的,所以让我知道我是否在某个地方买过它,如果您喜欢它,请给我一颗星星

:white_check_mark:安装:ok_hand: (:white_check_mark: Install :ok_hand:)

npm install laravel-vue-semantic-ui-pagination
// or
yarn add laravel-vue-semantic-ui-pagination

:white_check_mark:用法:mortar_board: (:white_check_mark: Usage :mortar_board:)

Register the component globally:

全局注册组件:

Vue.component('pagination', require('laravel-vue-semantic-ui-pagination'));

Or use locally

或在本地使用

import pagination from 'laravel-vue-semantic-ui-pagination';

:white_check_mark:示例:four_leaf_clover: (:white_check_mark: Example :four_leaf_clover:)

<ul>
    <li v-for="post in laravelData.data" v-text="post.title"></li>
</ul>
<pagination :data="laravelData" v-bind:showDisabled="true" icon="chevron" v-on:change-page="getResults"></pagination>
Vue.component('example-component', {

	data() {
		return {
			// Our data object that holds the Laravel paginator data
			laravelData: {},
		}
	},

	created() {
		// Fetch initial results
		this.getResults();
	},

	methods: {
		// Our method to GET results from a Laravel endpoint
		getResults(page) {
			if (typeof page === 'undefined') {
				page = 1;
			}

			// Using vue-resource as an example
			this.$http.get('example/results?page=' + page)
				.then(response => {
					return response.json();
				}).then(data => {
					this.laravelData = data;
				});
		}
	}

});

:white_check_mark::book:道具 (:white_check_mark: :book: Props)

NameTypeDescription
dataObjectAn object containing the structure of a Laravel paginator response. See below for default value.
limitNumber(optional) Limit of pages to be rendered. Default 0 (unlimited links) -1 will hide numeric pages and leave only arrow navigation. 3 will show 3 previous and 3 next numeric pages from current page.
showDisabledBoolean(optional) If set to true, will display left and right icons always.
iconString(optional) Default is angle double; Refer Semantic-UI Icons for specifying which icons you want.
sizeString(optional) Default is small; Refer Semantic-UI Menu Pagination for specifying the size of paginator.
名称 类型 描述
data 目的 包含Laravel分页器响应结构的对象。 请参阅下面的默认值。
limit (可选)要呈现的页面数限制。 默认值0 (无限链接) -1将隐藏数字页面并仅保留箭头导航。 3将显示当前页面的前3个数字页面和后3个数字页面。
showDisabled 布尔型 (可选)如果设置为true,将始终显示左右图标。
icon (可选)默认为angle double ; 请参阅Semantic-UI图标,以指定所需的图标。
size (可选)默认值为small ; 请参阅Semantic-UI菜单分页以指定分页器的大小。
{
	current_page: 1,
	data: [],
	from: 1,
	last_page: 1,
	next_page_url: null,
	per_page: 10,
	prev_page_url: null,
	to: 1,
	total: 0,
}

:white_check_mark::ear:事件 (:white_check_mark: :ear: Events)

NameDescription
change-pageTriggered when a user changes page. Passes the new page index as a parameter.
名称 描述
change-page 当用户更改页面时触发。 将新page索引作为参数传递。

翻译自: https://vuejsexamples.com/a-vuejs-2-x-pagination-used-with-laravel-semantic-ui/

semantic-ui

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值