定制 sevengroupfrance/sulu-range-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

sevengroupfrance/sulu-range-bundle

Composer 安装命令:

composer require sevengroupfrance/sulu-range-bundle

包简介

README 文档

README

Inspired by this pull request.

What is this bundle's goal?

Importing a custom fonctionality into sulu, in this example, a custom content type. This bundle will import a range input. The range input used is from react-range.

How the range input looks in sulu's admin

Installation

  1. Go to your assets/admin folder and install the react-switch npm package npm i react-range.

  2. Download the package in your project with the following command line:
    composer require sevengroupfrance/sulu-range-bundle.

  3. In config/bundles.php add the following code:
    SevenGroupFrance\SuluRangeBundle\SuluRangeBundle::class => ['all' => true].

  4. In assets/admin/package.json, add the following line in the "dependencies" object:
    "sulu-range-bundle": "file:node_modules/@sulu/vendor/sevengroupfrance/sulu-range-bundle/src/Resources/js".

  5. In assets/admin, npm install to initialize the bundle's symlink directory.

  6. In assets/admin/index.js, add this line:
    import 'sulu-range-bundle'.

  7. In assets/admin, npm run watch or npm run build

Use in your template files

Once installed, to use this new content type, you'll have to create a new property with the type sulu_range.

<property name="size" type="sulu_range">
  <meta>
    <title lang="en">Block size</title>
  </meta>
</property>

Setting the step, min and max values

Starting v1.0.1, you can configure your own basic values. To do so you will have to set several parameters in your sulu xml file template.

<property name="size" type="sulu_range">
  <meta>
    <title lang="en">Block size</title>
  </meta>
  <params>
    <param name="min" value="20" />
  </params>
</property>

The following parameters are available:
min(number): sets the minimum value (same as min attribute in html range input)
max(number): sets the maximum value (same as max attribute in html range input)
step(number): sets the step value (same as step attribute in html range input)
ratio(bool): sets how the output is rendered

If set to true, the ratio parameter will display the output like a ratio like this:

The radio rendered output

For further settings, please refer to the react-range github's readme

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-01-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固