承接 akhaled/select-country 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

akhaled/select-country

Composer 安装命令:

composer require akhaled/select-country

包简介

Select country with Select2

README 文档

README

Laravel package to select countries single or multiple using select2.

Installation

composer require akhaled/select-country

Then add Akhaled\SelectCountry\ServiceProvider::class to config/app.php providers

How to use

1. Add the component to your view

{{-- Single selection --}}
<div>
    <x-select-country name="selected_country"></x-select-country>
</div>

{{-- Multiple selection --}}
<div>
    <x-select-country name="countries[]" multiple="multiple"></x-select-country>
</div>

2. Add scripts

{{-- link-to-jquery --}
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/js/select2.min.js"></script>
@selectCountryScripts

3. Add select2 style

<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" />

Events

You can use select2 event by listening to element class .akhaled-select-country

example

<div>
    <x-select-country name="selected_country"></x-select-country>
    <div id="country-code"></div>
</div>

<script>
    $(document).delegate('.akhaled-select-country', 'select2:select', function(e) {
        let country = $(e.params.data.element).data('country')
        $('#country-code').text(`+${country.calling_code}`);
    });
</script>

The option is linked with data-country attribute that's contain more information about the country. See more

统计信息

  • 总下载量: 24
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-12-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固