Giter VIP home page Giter VIP logo

hejiang-tool's Introduction

page.php 使列表拥有分页功能

  1. 把此文件放到modules/mch/views/layouts目录下
  2. 使用<?= $this->render('../layouts/page.php', ['pagination' => $pagination]); ?> 需要传入一个Yii的分页类

delete.php 使列表拥有删除功能

  1. 把此文件放到modules/mch/views/layouts目录下
  2. 使用<?= $this->render('../layouts/delete.php'); ?>
  3. 需要自己定义一个类为delete-btn a标签,在href上面定义路由,就会拥有删除功能

Form.php,form_init.js 可以生成一些简单的表单

  1. Form.php路径为extensions/Form.php
  2. form_init.js路径为web\statics\mch\js\form_init.js,然后在modules\mch\views\layouts\main.php中引入<script src="<?= Yii::$app->request->baseUrl ?>/statics/mch/js/form_init.js"></script>
    • radios
    • image
    • images
    • text
    • email
    • checkboxs
    • datetimepicker
    • select
    • textarea
    • number
  3. 使用方式<?= Form::images($name,$value); ?>,不同的组件有不同的使用方式,可以查看Form.php的实现进行使用

search.php 可以生成简单的搜索

  1. 把此文件放到modules/mch/views/layouts目录下
  2. 使用<?= $this->render('../layouts/search.php', ['title' => '名称','title1' => '名称1']); ?>
  3. 可以在当前控制器接收到用户传title,title1的值

line-edit.php 可以生成行内编辑

  1. 把此文件放到modules/mch/views/layouts目录下
  2. 使用<?= $this->render('../layouts/line-edit.php']); ?>引入组件
  3. 在需要的地方给元素增加line-edit类,即可

<a data-id="<?= $goods->id ?>" data-edit-url="<?= $urlManager->createUrl(['mch/goods/edit-goods-num']) ?>" data-field="regions" data-value="<?= $goods->regions ?>" class="line-edit">修改</a>

以下是一些属性定义

属性字段 描述 是否可选 默认值
data-id 数据的唯一id
data-field 要修改的数据字段
data-value 数据值
data-edit-url 请求的url 默认为当前控制器的line-edit方法

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.