loki/magento2-flatpickr 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

loki/magento2-flatpickr

最新稳定版本:1.0.5

Composer 安装命令:

composer require loki/magento2-flatpickr

包简介

Magento 2 module to add an Alpine.js directive x-flatpickr

关键字:

README 文档

README

This Magento 2 module adds an Alpine.js x-flatpickr directive to transform a simple input field into a Flatpickr date picker.

Installation

composer require loki/magento2-flatpickr
bin/magento module:enable Loki_Flatpickr

Usage

To add Flatpickr to a custom HTML input, just add the x-flatpickr directive to your HTML element:

<input type="date" x-flatpickr/>

If you want to add Flatpickr to a Loki Field Component, add the x-flatpickr directive via the XML layout:

<block name="example" template="Loki_FieldComponents::form/field.phtml">
    <arguments>
        <argument name="input_type" xsi:type="string">date</argument>
        <argument name="field_attributes" xsi:type="array">
            <item name="x-flatpickr" xsi:type="boolean">true</item>
        </argument>
    </arguments>
</block>

Customization

The Flatpickr directive is inserted via a block loki.directives.flatpickr. If you want to change the options for Flatpickr, you can use the block argument options for this:

<referenceBlock name="loki.directives.flatpickr">
    <arguments>
        <argument name="options" xsi:type="array">
            <item name="altFormat" xsi:type="string">d-m-Y</item>
        </argument>
    </arguments>
</referenceBlock>

For all options, see https://flatpickr.js.org/options/

Note that changing the dateFormat will also change the value sent to Magento. It is probably best to keep this at its default (Y-m-d).

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: OSL-3.0
  • 更新时间: 2025-08-31