<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 初始化 ~~~ return ZBuilder::make('form') ->setPageTitle('新增商品') ->addFormItems($fields) // ->layout([) ->setFormData([ 'product_id'=>$p_id, ]) ->fetch(); } ~~~ ## 設置頁面標題 setPageTitle(‘頁面標題’) 和表單構建器的用法一樣,一般情況下,無需調用這個方法,系統會自動獲取當前操作的名稱,前提是該操作已經添加到菜單節點。 也可以重新設置頁面標題 ~~~ // 使用ZBuilder構建數據表格,并將頁面標題設置為“列表” return ZBuilder::make('table')->setPageTitle('列表')->fetch(); ~~~ ## 設置頁面提示信息 `setPageTips(‘提示信息’ [,‘提示類型’])` 中括號的里的參數為可選參數,后面的其他方法也是如此 提示信息 ~~~ // 使用ZBuilder構建數據表格 return ZBuilder::make('table')->setPageTips('這是頁面提示信息')->fetch(); ~~~ 提示類型 默認提示類型是info,除此之外還有success、danger、warning ~~~ // 使用ZBuilder構建數據表格 return ZBuilder::make('table') ->setPageTips('這是頁面提示信息', 'danger') ->fetch(); ~~~ > 提示信息里里還可以加鏈接 是支持html代碼的 包裹在p里 # 添加單個項目 添加表單項功能是表單構建器的重中之重,系統內置了多達30幾種不同的表單類型,可以隨心所欲的構建表單頁面 `addCheckbox(‘name值’, ‘標題’, ‘提示’, ‘數據項’ [, ‘默認值’, ’ 屬性’, ‘額外屬性’, ‘額外css類’])` ## 復選 ## addCheckbox(‘name值’, ‘標題’, ‘提示’, ‘數據項’ [, ‘默認值’, ’ 屬性’, ‘額外屬性’, ‘額外css類’]) 標識符:`checkbox` | 參數 | 含義 | 類型 | | --- | --- | --- | | name | name值 | string | | title | 標題 | string | | tips | 提示 | string | | options | 數據項 | array | | default | 默認值 | string | | attr | 屬性 | array | | extra_attr | 額外屬性 | string | | extra_class | 額外css類 | string | ### 一個簡單的復選框 ~~~ return ZBuilder::make('form') ->setPageTitle('添加') ->addCheckbox('city', '選擇城市', '', ['gz' => '廣州', 'sz' => '深圳', 'sh' => '上海']) ->fetch(); ~~~ ![](https://box.kancloud.cn/03c4c36bbff86ec399cd1b9db8af6f4c_254x145.png) ### 帶默認值的復選框 ~~~ $list_city = ['gz' => '廣州', 'sz' => '深圳', 'sh' => '上海']; return ZBuilder::make('form') ->setPageTitle('添加') ->addCheckbox('city', '選擇城市', '請選擇城市', $list_city, 'gz') ->fetch(); ~~~ 也可以同時選中多個 ~~~ $list_city = ['gz' => '廣州', 'sz' => '深圳', 'sh' => '上海']; return ZBuilder::make('form') ->setPageTitle('添加') ->addCheckbox('city', '選擇城市', '請選擇城市', $list_city, 'gz,sh') ->fetch(); ~~~ ![](https://box.kancloud.cn/de93fbf585601f29f3e600a3672f6ea2_274x164.png) 或者使用數組的方式,都是一樣的 ~~~ $list_city = ['gz' => '廣州', 'sz' => '深圳', 'sh' => '上海']; return ZBuilder::make('form') ->setPageTitle('添加') ->addCheckbox('city', '選擇城市', '請選擇城市', $list_city, ['gz', 'sh']) ->fetch(); ~~~ ### 定義復選框的屬性 可以設置復選框的顏色、尺寸、形狀 #### 顏色(color) * `primary`?(默認) * `default` * `info` * `success` * `warning` * `danger` ~~~ $list_city = ['gz' => '廣州', 'sz' => '深圳', 'sh' => '上海']; return ZBuilder::make('form') ->setPageTitle('添加') ->addCheckbox('city', '選擇城市', '請選擇城市', $list_city, ['gz', 'sh'], ['color' => 'danger']) ->fetch(); ~~~ ![](https://box.kancloud.cn/7524047f374333b7efae85d0c3dc65bf_239x102.png) #### 尺寸(size) * `sm`?(默認) * `nm` * `lg` ~~~ $list_city = ['gz' => '廣州', 'sz' => '深圳', 'sh' => '上海']; return ZBuilder::make('form') ->setPageTitle('添加') ->addCheckbox('city', '選擇城市', '', $list_city, '', ['size' => 'lg']) ->fetch(); ~~~ ![](https://box.kancloud.cn/ddfa373fcac78db6cdd5327a5148578d_252x94.png) #### 形狀(shape) * `rounded`?(默認) * `square` ~~~ $list_city = ['gz' => '廣州', 'sz' => '深圳', 'sh' => '上海']; return ZBuilder::make('form') ->setPageTitle('添加') ->addCheckbox('city', '選擇城市', '', $list_city, '', ['shape' => 'square']) ->fetch(); ~~~ 三種屬性可以一起使用 ~~~ $list_city = ['gz' => '廣州', 'sz' => '深圳', 'sh' => '上海']; return ZBuilder::make('form') ->setPageTitle('添加') ->addCheckbox('city', '選擇城市', '', $list_city, '', ['color' => 'danger', 'size' => 'lg', 'shape' => 'square']) ->fetch(); ~~~ ### 添加額外屬性 比如默認為禁用狀態 ~~~ $list_city = ['gz' => '廣州', 'sz' => '深圳', 'sh' => '上海']; return ZBuilder::make('form') ->setPageTitle('添加') ->addCheckbox('city', '選擇城市', '', $list_city, '', '', 'disabled') ->fetch(); ~~~ ### 添加額外css類 ~~~ $list_city = ['gz' => '廣州', 'sz' => '深圳', 'sh' => '上海']; return ZBuilder::make('form') ->setPageTitle('添加') ->addCheckbox('city', '選擇城市', '', $list_city, '', '', '', 'active') ->fetch(); ~~~ > 這里添加的css類是自定義的,有特殊要求時才需要,請根據實際開發來決定 ## 添加表單項通用方法 除了可以用不同的方法來添加表單項外,DolphinPHP還為大家提供兩個通用方法。 ## 添加單個表單項 #### addFormItem() 比如創建一個表單,一般情況下可能這么寫 ~~~ return ZBuilder::make('form') ->addText('title', '標題') ->addTextarea('summary', '摘要') ->addUeditor('content', '內容') ->addImage('pic', '封面') ->addTags('tags', '標簽') ->addFile('files', '附件') ->fetch(); ~~~ 也可以用`addFormItem()`方法代替,第一個參數是表單項的標識符,其他參數與其對應的類型參數一致。 ~~~ return ZBuilder::make('form') ->addFormItem('text', 'title', '標題') ->addFormItem('textarea', 'summary', '摘要') ->addFormItem('ueditor', 'content', '內容') ->addFormItem('image', 'pic', '封面') ->addFormItem('tags', 'tags', '標簽') ->addFormItem('file', 'files', '附件') ->fetch(); ~~~ ## 添加多個表單項 #### addFormItems() 還是感覺上面的寫法比較啰嗦嗎?沒關系,我們還有`addFormItems()`方法。比如上面的例子,可以寫成 ~~~ return ZBuilder::make('form') ->addFormItems([ ['text', 'title', '標題'], ['textarea', 'summary', '摘要'], ['ueditor', 'content', '內容'], ['image', 'pic', '封面'], ['tags', 'tags', '標簽'], ['file', 'files', '附件'] ]) ->fetch(); ~~~ 是不是看起來簡潔很多? > 注意:addFormItems的參數是一個數組,每個元素是一個表單項數組。 daterange的 layout設置 是`name[]` 比方說你的daterange 的name 是create_time 那么就是`create_time[]`
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看