dwz的form表單中url的變數替換

來源:互聯網
上載者:User

標籤:style   blog   http   io   color   ar   使用   sp   for   

form表單中action的地址格式 __URL__/edit/{xxx},大括弧內的 “xxx” 就是變數名,主要功能是結合table組件一起使用。

中的刪除、編輯、修改密碼都是用了url變數替換:

刪除、編輯、修改密碼使用了變數{sid_user},特別需要注意的是變數命名的格式,必須以"sid_"開頭,這樣後台可以直接以變數"sid"接收。

<tbody>中<tr target="sid_user" rel="<%= value %>">

當選中一行時,tr上的rel值會自動替換到url變數中.

程式碼範例:

 1 <a class="delete" href="__URL__/foreverdelete/{sid_user}" target="ajaxTodo" title="你確定要刪除嗎?" warn="請選擇使用者"><span>刪除</span></a> 2  3 <a class="edit" href="__URL__/edit/{sid_user}" target="dialog" mask="true" warn="請選擇使用者"><span>編輯</span></a> 4  5 <a class="icon" href="__URL__/password/{sid_user}" target="dialog" mask="true" warn="請選擇使用者"><span>修改密碼</span></a> 6  7 <table class="list" width="100%" layoutH="116"> 8     <thead> 9     <tr>10         <th width="60">編號</th>11         <th width="100">使用者名稱</th>12         <th>暱稱</th>13         <th>Email</th>14         <th width="100">添加時間</th>15         <th width="120">上次登入</th>16         <th width="80">登入次數</th>17         <th width="80">狀態</th>18     </tr>19     </thead>20     <tbody>21     <volist id="vo" name="list">22         <tr target="sid_user" rel="<%= id %>">23             <td><%= id %></td>24             <td><%= account %></td>25             <td><%= nickname %></td>26             <td><%= email %></td>27             <td><%= create_time %></td>28             <td><%= last_login_time %></td>29             <td><%= login_count %></td>30             <td><%= status %></td>31         </tr>32     </volist>33     </tbody>34 </table>

 

注意: url變數名{sid_user}和tr的target="sid_user"保持一致.

    在最近的工作過程中,發現一個bug,我將form表單的action寫成了“ action=‘#‘ ”,通過js事件來改變action的值,但是如果不挑選清單項直接點擊新增或刪除按鈕時,頁面不能正常提示“請選擇資訊”的提示,而是直接在彈出層內載入了首頁,後來經過領導的指點才發現就是因為我寫的action的原因;後來為了保證js動態改變action地址的同時實現彈出提醒資訊的功能,我之間將action的值預設為“action={sid_user}”的格式,最後實現了預先的需求。

dwz的form表單中url的變數替換

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.