Giter Club home page Giter Club logo

Comments (2)

mbdmt avatar mbdmt commented on July 22, 2024

直接在這個git主頁右上角 Code -> Download zip
下載後的.zip包直接進dcat後台 開發工具-> 本地安裝 指定剛剛那個zip就能裝上

這裡我提供小改的測試樣本

    protected function form()
    {
        return Form::make(new yourstepsl(), function (Form $form) {
            $form->multipleSteps()
                ->remember() // 记住表单步骤,默认不开启
                ->width('950px')
                ->add('基本信息', function ($step) {

                    $step->text('type', 'Types')->required();
                })
                ->add('兴趣爱好', function ($step) {
                    $step->text('content', '內容');

                    // 事件
                    $step->shown(function () {
                        return <<<JS
        Dcat.info('兴趣爱好');
        console.log('兴趣爱好', args);
        JS;
                    });

                })
                ->add('地址', function ($step) {
                    $step->text('addr', 'Addr');
                })
                ->done(function ($done){

                    $newId = $done->getNewId();
                    return '成功!! newId: '.$newId;
                    //return view('admin::form.done-step', $data);
                });
            });
        }
    }

from form-step.

YenLung-Huang avatar YenLung-Huang commented on July 22, 2024

直接在這個git主頁右上角 Code -> Download zip 下載後的.zip包直接進dcat後台 開發工具-> 本地安裝 指定剛剛那個zip就能裝上

這裡我提供小改的測試樣本

    protected function form()
    {
        return Form::make(new yourstepsl(), function (Form $form) {
            $form->multipleSteps()
                ->remember() // 记住表单步骤,默认不开启
                ->width('950px')
                ->add('基本信息', function ($step) {

                    $step->text('type', 'Types')->required();
                })
                ->add('兴趣爱好', function ($step) {
                    $step->text('content', '內容');

                    // 事件
                    $step->shown(function () {
                        return <<<JS
        Dcat.info('兴趣爱好');
        console.log('兴趣爱好', args);
        JS;
                    });

                })
                ->add('地址', function ($step) {
                    $step->text('addr', 'Addr');
                })
                ->done(function ($done){

                    $newId = $done->getNewId();
                    return '成功!! newId: '.$newId;
                    //return view('admin::form.done-step', $data);
                });
            });
        }
    }

嘗試上述的方法沒有用,因為檔案數少,解決方式為直接將檔案移至專案裡面,在 Directory 底下建立 Extends,修正 namespace,修正 resource,public

app/Admin
├── Extends
│   └── FormStep
│       ├── Builder.php
│       ├── CompletionPage.php
│       ├── Form.php

,之後在 bootstrap.php 裡面引用,之後 formstep 就可以正常使用

/**
 * FormStep
 */
Admin::css('vendor/dcat-admin-extensions/dcat-admin/form-step/css/step.css');
Admin::js('vendor/dcat-admin-extensions/dcat-admin/form-step/js/jquery.smartWizard.min.js');

Form::macro('multipleSteps', function ($builder = null) {
    if (empty($this->context['steps'])) {
        $this->context['steps'] = new App\Admin\Extends\FormStep\Builder($this);
    }

    if ($builder) {
        if ($builder instanceof \Closure) {
            $builder($this->context['steps']);
        } elseif (is_array($builder)) {
            $this->context['steps']->add($builder);
        }
    }

    return $this->context['steps'];
});

from form-step.

Related Issues (5)

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.