天天看點

Tyrion中文文檔(含示例源碼)

Tyrion是一個基于Python實作的支援多個WEB架構的Form表單驗證元件,其完美的支援Tornado、Django、Flask、Bottle Web架構。Tyrion主要有兩大重要動能:

  • 表單驗證
  • 生成HTML标簽
  • 保留上次送出内容

對于表單驗證,告别書寫重複的正規表達式對使用者送出的資料進行驗證的工作,從此解放雙手,跟着我左手右手一個慢動作...

對于生成HTML标簽,不在人工書寫html标簽,讓Tyrion幫你自動建立...

對于保留上次送出内容,由于預設表單送出後頁面重新整理,原來輸入的内容會清空,Tyrion可以保留上次送出内容。

github:https://github.com/WuPeiqi/Tyrion

Tyrion中文文檔(含示例源碼)

使用文檔

1、下載下傳安裝

pip install PyTyrion       

github: https://github.com/WuPeiqi/Tyrion

2、配置WEB架構種類

由于Tyrion同時支援Tornado、Django、Flask、Bottle多個WEB架構,所有在使用前需要進行指定。 

import Tyrion
        Tyrion.setup('tornado') 
        # setup的參數有:tornado(預設)、django、bottle、flask      

3、建立Form類

Form類用于提供驗證規則、插件屬性、錯誤資訊等

from Tyrion.Forms import Form
    from Tyrion.Fields import StringField
    from Tyrion.Fields import EmailField

    class LoginForm(Form):
        username = StringField(error={'required': '使用者名不能為空'})
        password = StringField(error={'required': '密碼不能為空'})
        email = EmailField(error={'required': '郵箱不能為空', 'invalid': '郵箱格式錯誤'})
      

4、驗證使用者請求

前端HTML代碼:

<form method="POST" action="/login.html">
            <div>
                <input type="text" name="username">
            </div>
            <div>
                <input type="text" name="password">
            </div>
            <div>
                <input type="text" name="email">
            </div>

            <input type="submit" value="送出">
        </form>
      

使用者送出資料時,在背景書寫如下代碼即可實作使用者請求資料驗證(Tornado示例):

class LoginHandler(tornado.web.RequestHandler):
            def get(self, *args, **kwargs):
                self.render('login.html')

            def post(self, *args, **kwargs):
                form = LoginForm(self)

                ###### 檢查使用者輸入是否合法 ######
                if form.is_valid():

                    ###### 如果不合法,則輸出錯誤資訊 ######
                    print(form.error_dict)
                else:
                    ###### 如果合法,則輸出使用者輸入的内容 ######
                    print(form.value_dict)
                self.render('login.html')      

示例01:源碼下載下傳(含Tornado、Django、Flask、Bottle)

5、驗證使用者請求 && 生成HTML标簽 && 保留上次輸入内容 && 錯誤提示

Tyrion不僅可以驗證使用者請求,還可以生成自動建立HTML标簽并且可以保留使用者上次輸入的内容。在HTML模闆中調用Form類對象的字段即可,如(Tornado示例):

Tyrion中文文檔(含示例源碼)
Tyrion中文文檔(含示例源碼)
from Tyrion.Forms import Form
        from Tyrion.Fields import StringField
        from Tyrion.Fields import EmailField

        class LoginForm(Form):
            username = StringField(error={'required': '使用者名不能為空'})
            password = StringField(error={'required': '密碼不能為空'})
            email = EmailField(error={'required': '郵箱不能為空', 'invalid': '郵箱格式錯誤'})      

Form類

Tyrion中文文檔(含示例源碼)
Tyrion中文文檔(含示例源碼)
class LoginHandler(tornado.web.RequestHandler):
            def get(self, *args, **kwargs):
                form = LoginForm(self)
                self.render('login.html', form=form)

            def post(self, *args, **kwargs):
                form = LoginForm(self)

                print(form.is_valid())
                print(form.error_dict)
                print(form.value_dict)

                self.render('login.html', form=form)      

處理請求(Tornado)

Tyrion中文文檔(含示例源碼)
Tyrion中文文檔(含示例源碼)
<form method="post" action="/login.html">
            <div>
                <!-- Form建立的标簽 -->
                {% raw form.username %}

                <!-- 錯誤資訊 -->
                <span>{{form.error_dict.get('username',"")}}</span>
            </div>
            <div>
                {% raw form.password %}
                <span>{{form.error_dict.get('password',"")}}</span>
            </div>
            <div>
                {% raw form.email %}
                <span>{{form.error_dict.get('email',"")}}</span>
            </div>
            <input type="submit" value="送出"/>
        </form>      

HTML模闆login.html

注意: HTML模闆中的轉義

示例02:源碼下載下傳(含有Tornado、Django、Flask、Bottle)

6、Form字段類型

Form的字段用于指定從請求中擷取的資料類型以及格式,以此來驗證使用者輸入的内容。

from Tyrion.Forms import Form
        from Tyrion.Fields import StringField
        from Tyrion.Fields import EmailField

        class LoginForm(Form):
            username = StringField(error={'required': '使用者名不能為空'})
            password = StringField(error={'required': '密碼不能為空'})
            email = EmailField(error={'required': '郵箱不能為空', 'invalid': '郵箱格式錯誤'})
      

以上代碼表示此Form類可以用于驗證使用者輸入的内容,并且 username和password必須不能為空,email必須不能為空并且必須是郵箱格式。

目前支援所有字段:

Tyrion中文文檔(含示例源碼)
Tyrion中文文檔(含示例源碼)
StringField
    """
    要求必須是字元串,即:正則^.*$
 
    參數:
        required    布爾值,是否允許為空
        max_length  整數,限制使用者輸入内容最大長度
        min_length  整數,限制使用者輸入内容最小長度
        error       字典,自定義錯誤提示,如:{
                                            'required': '值為空時的錯誤提示',
                                            'invalid': '格式錯誤時的錯誤提示',
                                            'max_length': '最大長度為10',
                                            'min_length': '最小長度為1',
                                          }
        widget      定制生成的HTML插件(預設InputText)
    """
 
EmailField
    """
    要求必須是郵箱格式的字元串
 
    參數:
        required    布爾值,是否允許為空
        max_length  整數,限制使用者輸入内容最大長度
        min_length  整數,限制使用者輸入内容最小長度
        error       字典,自定義錯誤提示,如:{
                                            'required': '值為空時的錯誤提示',
                                            'invalid': '格式錯誤時的錯誤提示',
                                            'max_length': '最大長度為10',
                                            'min_length': '最小長度為1',
                                          }
        widget      定制生成的HTML插件(預設InputText)
    """
 
IPField
    """
    要求必須是IP格式
 
    參數:
        required    布爾值,是否允許為空
        max_length  整數,限制使用者輸入内容最大長度
        min_length  整數,限制使用者輸入内容最小長度
        error       字典,自定義錯誤提示,如:{
                                            'required': '值為空時的錯誤提示',
                                            'invalid': '格式錯誤時的錯誤提示',
                                            'max_length': '最大長度為10',
                                            'min_length': '最小長度為1',
                                          }
        widget      定制生成的HTML插件(預設InputText)
 
    """
 
IntegerField
    """
    要求必須整數格式
 
    參數:
        required    布爾值,是否允許為空
        max_value   整數,限制使用者輸入數字最大值
        min_value   整數,限制使用者輸入數字最小值
        error       字典,自定義錯誤提示,如:{
                                            'required': '值為空時的錯誤提示',
                                            'invalid': '格式錯誤時的錯誤提示',
                                            'max_value': '最大值為10',
                                            'max_value': '最小值度為1',
                                          }
        widget      定制生成的HTML插件(預設InputText)
 
    """
 
FloatField
    """
    要求必須小數格式
 
    參數:
        required    布爾值,是否允許為空
        max_value   整數,限制使用者輸入數字最大值
        min_value   整數,限制使用者輸入數字最小值
        error       字典,自定義錯誤提示,如:{
                                            'required': '值為空時的錯誤提示',
                                            'invalid': '格式錯誤時的錯誤提示',
                                            'max_value': '最大值為10',
                                            'max_value': '最小值度為1',
                                          }
        widget      定制生成的HTML插件(預設InputText)
    """
 
StringListField
    """
    用于擷取請求中的多個值,且保證每一個元素是字元串,即:正則^.*$
    如:checkbox或selct多選時,會送出多個值,用此字段可以将使用者送出的值儲存至清單
 
    參數:
        required         布爾值,是否允許為空
        ele_max_length   整數,限制使用者輸入的每個元素内容最大長度
        ele_min_length   整數,限制使用者輸入的每個元素内容最小長度
        error            字典,自定義錯誤提示,如:{
                                            'required': '值為空時的錯誤提示',
                                            'element': '清單中的元素必須是字元串',
                                            'ele_max_length': '最大長度為10',
                                            'ele_min_length': '最小長度為1',
                                          }
        widget           定制生成的HTML插件(預設InputMultiCheckBox,即:checkbox)
    """
 
IntegerListField
    """
    用于擷取請求中的多個值,且保證每一個元素是整數
    如:checkbox或selct多選時,會送出多個值,用此字段可以将使用者送出的值儲存至清單
 
    參數:
        required         布爾值,是否允許為空
        ele_max_value   整數,限制使用者輸入的每個元素内容最大長度
        ele_min_value   整數,限制使用者輸入的每個元素内容最小長度
        error            字典,自定義錯誤提示,如:{
                                            'required': '值為空時的錯誤提示',
                                            'element': '清單中的元素必須是數字',
                                            'ele_max_value': '最大值為x',
                                            'ele_min_value': '最小值為x',
                                          }
        widget           定制生成的HTML插件(預設InputMultiCheckBox,即:checkbox)
    """      

View Code

7、Form字段widget參數:HTML插件

HTML插件用于指定目前字段在生成HTML時表現的種類和屬性,通過指定此參數進而實作定制頁面上生成的HTML标簽

from Tyrion.Forms import Form
            from Tyrion.Fields import StringField
            from Tyrion.Fields import EmailField

            from Tyrion.Widget import InputPassword

            class LoginForm(Form):
                password = StringField(error={'required': '密碼不能為空'},widget=InputPassword())
      

上述LoginForm的password字段要求使用者輸入必須是字元串類型,并且指定生成HTML标簽時會建立為<input type='password' > 标簽

目前支援所有插件:

Tyrion中文文檔(含示例源碼)
Tyrion中文文檔(含示例源碼)
InputText
        """
        設定Form對應字段在HTML中生成input type='text' 标簽

        參數:
            attr    字典,指定生成标簽的屬性,如: attr = {'class': 'c1', 'placeholder': 'username'}
        """
    InputEmail
        """
        設定Form對應字段在HTML中生成input type='email' 标簽

        參數:
            attr    字典,指定生成标簽的屬性,如: attr = {'class': 'c1', 'placeholder': 'username'}
        """
    InputPassword
        """
        設定Form對應字段在HTML中生成input type='password' 标簽

        參數:
            attr    字典,指定生成标簽的屬性,如: attr = {'class': 'c1', 'placeholder': 'username'}
        """
    TextArea
        """
        設定Form對應字段在HTML中生成 textarea 标簽

        參數:
            attr    字典,指定生成标簽的屬性,如: attr = {'class': 'c1'}
            value   字元串,用于設定textarea标簽中預設顯示的内容
        """

    InputRadio
        """
        設定Form對應字段在HTML中生成一系列 input type='radio' 标簽(選擇時互斥)

        參數:
            attr                字典,生成的HTML屬性,如:{'class': 'c1'}
            text_value_list     清單,生成的多個radio标簽的内容和值,如:[
                                                                {'value':1, 'text': '男'},
                                                                {'value':2, 'text': '女'},
                                                            ]
            checked_value       整數或字元串,預設被選中的标簽的value的值

        示例:
                from Tyrion.Forms import Form
                from Tyrion.Fields import IntegerField

                from Tyrion.Widget import InputRadio


                class LoginForm(Form):
                    favor = IntegerField(error={'required': '愛好不能為空'},
                                         widget=InputRadio(attr={'class': 'c1'},
                                                           text_value_list=[
                                                               {'value': 1, 'text': '男'},
                                                               {'value': 2, 'text': '女'}, ],
                                                           checked_value=2
                                                           )
                                         )
                上述favor字段生成的HTML标簽為:
                    <div>
                        <span>
                            <input class='c1' type="radio" name="gender" value="1">
                        </span>
                        <span>男</span>
                    </div>
                    <div>
                        <span>
                            <input class='c1' type="radio" name="gender" value="2" checked='checked'>
                        </span>
                        <span>女</span>
                    </div>
        """

    InputSingleCheckBox
        """
        設定Form對應字段在HTML中生成 input type='checkbox' 标簽
        參數:
            attr    字典,指定生成标簽的屬性,如: attr = {'class': 'c1'}
        """

    InputMultiCheckBox
        """
        設定Form對應字段在HTML中生成一系列 input type='checkbox' 标簽

        參數:
            attr                字典,指定生成标簽的屬性,如: attr = {'class': 'c1'}
            text_value_list     清單,生成的多個checkbox标簽的内容和值,如:[
                                                                        {'value':1, 'text': '籃球'},
                                                                        {'value':2, 'text': '足球'},
                                                                        {'value':3, 'text': '乒乓球'},
                                                                        {'value':4, 'text': '羽毛球'},
                                                                    ]
            checked_value_list  清單,預設選中的标簽對應的value, 如:[1,3]
        """
    SingleSelect
        """
        設定Form對應字段在HTML中生成 單選select 标簽

        參數:
            attr                字典,指定生成标簽的屬性,如: attr = {'class': 'c1'}
            text_value_list     清單,用于指定select标簽中的option,如:[
                                                                        {'value':1, 'text': '北京'},
                                                                        {'value':2, 'text': '上海'},
                                                                        {'value':3, 'text': '廣州'},
                                                                        {'value':4, 'text': '重慶'},
                                                                    ]
            selected_value      數字或字元串,預設被選中選項對應的值,如: 3
        """

    MultiSelect
        """
        設定Form對應字段在HTML中生成 多選select 标簽

        參數:
            attr                字典,指定生成标簽的屬性,如: attr = {'class': 'c1'}
            text_value_list     清單,用于指定select标簽中的option,如:[
                                                                        {'value':1, 'text': '籃球'},
                                                                        {'value':2, 'text': '足球'},
                                                                        {'value':3, 'text': '乒乓球'},
                                                                        {'value':4, 'text': '羽毛球'},
                                                                    ]
            selected_value_list 清單,預設被選中選項對應的值,如:[2,3,4]
        """      

8、動态初始化預設值

由于Form可以用于生成HTML标簽,如果想要在建立标簽的同時再為其設定預設值有兩種方式:

  • 靜态,在插件參數中指定
  • 動态,調用Form對象的 init_field_value 方法來指定
Tyrion中文文檔(含示例源碼)
Tyrion中文文檔(含示例源碼)
class InitValueForm(Form):
        username = StringField(error={'required': '使用者名不能為空'})
        age = IntegerField(max_value=500,
                           min_value=0,
                           error={'required': '年齡不能為空',
                                  'invalid': '年齡必須為數字',
                                  'min_value': '年齡不能小于0',
                                  'max_value': '年齡不能大于500'})

        city = IntegerField(error={'required': '年齡不能為空', 'invalid': '年齡必須為數字'},
                            widget=SingleSelect(text_value_list=[{'value': 1, 'text': '上海'},
                                                                 {'value': 2, 'text': '北京'},
                                                                 {'value': 3, 'text': '廣州'}])
                            )

        gender = IntegerField(error={'required': '請選擇性别',
                                     'invalid': '性别必須為數字'},
                              widget=InputRadio(text_value_list=[{'value': 1, 'text': '男', },
                                                                 {'value': 2, 'text': '女', }],
                                                checked_value=2))

        protocol = IntegerField(error={'required': '請選擇協定', 'invalid': '協定格式錯誤'},
                                widget=InputSingleCheckBox(attr={'value': 1}))

        favor_int_val = IntegerListField(error={'required': '請選擇愛好', 'invalid': '選擇愛好格式錯誤'},
                                         widget=InputMultiCheckBox(text_value_list=[{'value': 1, 'text': '籃球', },
                                                                                    {'value': 2, 'text': '足球', },
                                                                                    {'value': 3, 'text': '乒乓球', },
                                                                                    {'value': 4, 'text': '羽毛球'}, ]))

        favor_str_val = StringListField(error={'required': '請選擇愛好', 'invalid': '選擇愛好格式錯誤'},
                                        widget=InputMultiCheckBox(text_value_list=[{'value': '1', 'text': '籃球', },
                                                                                   {'value': '2', 'text': '足球', },
                                                                                   {'value': '3', 'text': '乒乓球', },
                                                                                   {'value': '4', 'text': '羽毛球'}, ]))

        select_str_val = StringListField(error={'required': '請選擇愛好', 'invalid': '選擇愛好格式錯誤'},
                                         widget=MultiSelect(text_value_list=[{'value': '1', 'text': '籃球', },
                                                                             {'value': '2', 'text': '足球', },
                                                                             {'value': '3', 'text': '乒乓球', },
                                                                             {'value': '4', 'text': '羽毛球'}, ]))

        select_int_val = IntegerListField(error={'required': '請選擇愛好', 'invalid': '選擇愛好格式錯誤'},
                                          widget=MultiSelect(text_value_list=[{'value': 1, 'text': '籃球', },
                                                                              {'value': 2, 'text': '足球', },
                                                                              {'value': 3, 'text': '乒乓球', },
                                                                              {'value': 4, 'text': '羽毛球'}, ]))      

動态初始值 - Form類

Tyrion中文文檔(含示例源碼)
Tyrion中文文檔(含示例源碼)
class InitValueHandler(tornado.web.RequestHandler):

            def get(self, *args, **kwargs):
                form = InitValueForm(self)

                init_dict = {
                    'username': 'seven',
                    'age': 18,
                    'city': 2,
                    'gender': 2,
                    'protocol': 1,
                    'favor_int_val': [1, 3],
                    'favor_str_val': ['1', '3'],
                    'select_int_val': [1, 3],
                    'select_str_val': ['1', '3']

                }

                # 初始化操作,設定Form類中預設值以及預設選項
                form.init_field_value(init_dict)

                self.render('init_value.html', form=form)      

動态初始值 - 處理請求的Handler(Tornado)

9、更多示例

示例源碼下載下傳:猛擊這裡

a. 基本使用

class RegisterForm(Form):
            username = StringField(max_length=32,
                                   min_length=6,
                                   error={'required': '使用者名不能為空',
                                          'min_length': '使用者名不能少于6位',
                                          'max_length': '使用者名不能超過32位'})

            password = StringField(max_length=32,
                                   min_length=6,
                                   error={'required': '密碼不能為空'},
                                   widget=InputPassword())

            gender = IntegerField(error={'required': '請選擇性别',
                                         'invalid': '性别必須為數字'},
                                  widget=InputRadio(text_value_list=[{'value': 1, 'text': '男', },
                                                                     {'value': 2, 'text': '女', }],
                                                    checked_value=2))

            age = IntegerField(max_value=500,
                               min_value=0,
                               error={'required': '年齡不能為空',
                                      'invalid': '年齡必須為數字',
                                      'min_value': '年齡不能小于0',
                                      'max_value': '年齡不能大于500'})

            email = EmailField(error={'required': '郵箱不能為空',
                                      'invalid': '郵箱格式錯誤'})

            city = IntegerField(error={'required': '城市選項不能為空', 'invalid': '城市選項必須為數字'},
                                widget=SingleSelect(text_value_list=[{'value': 1, 'text': '上海'},
                                                                     {'value': 2, 'text': '北京'},
                                                                     {'value': 3, 'text': '廣州'}])
                                )
            protocol = IntegerField(error={'required': '請選擇協定', 'invalid': '協定格式錯誤'},
                                    widget=InputSingleCheckBox(attr={'value': 1}))

            memo = StringField(required=False,
                               max_length=150,
                               error={'invalid': '備注格式錯誤', 'max_length': '備注最大長度為150字'},
                               widget=TextArea())
      

b. 多選checkbox

class MultiCheckBoxForm(Form):
             favor_str_val = StringListField(error={'required': '請選擇愛好', 'invalid': '選擇愛好格式錯誤'},
                                             widget=InputMultiCheckBox(text_value_list=[{'value': '1', 'text': '籃球', },
                                                                                        {'value': '2', 'text': '足球', },
                                                                                        {'value': '3', 'text': '乒乓球', },
                                                                                        {'value': '4', 'text': '羽毛球'}, ]))

             favor_str_val_default = StringListField(error={'required': '請選擇愛好', 'invalid': '選擇愛好格式錯誤'},
                                                     widget=InputMultiCheckBox(text_value_list=[{'value': '1', 'text': '籃球', },
                                                                                                {'value': '2', 'text': '足球', },
                                                                                                {'value': '3', 'text': '乒乓球', },
                                                                                                {'value': '4', 'text': '羽毛球'}, ],
                                                                               checked_value_list=['1', '4']))

             favor_int_val = IntegerListField(error={'required': '請選擇愛好', 'invalid': '選擇愛好格式錯誤'},
                                              widget=InputMultiCheckBox(text_value_list=[{'value': 1, 'text': '籃球', },
                                                                                         {'value': 2, 'text': '足球', },
                                                                                         {'value': 3, 'text': '乒乓球', },
                                                                                         {'value': 4, 'text': '羽毛球'}, ]))

             favor_int_val_default = IntegerListField(error={'required': '請選擇愛好', 'invalid': '選擇愛好格式錯誤'},
                                                      widget=InputMultiCheckBox(text_value_list=[{'value': 1, 'text': '籃球', },
                                                                                                 {'value': 2, 'text': '足球', },
                                                                                                 {'value': 3, 'text': '乒乓球', },
                                                                                                 {'value': 4, 'text': '羽毛球'}, ],
                                                                                checked_value_list=[2, ]))
      

c、多選select

class MultiSelectForm(Form):
            select_str_val = StringListField(error={'required': '請選擇愛好', 'invalid': '選擇愛好格式錯誤'},
                                             widget=MultiSelect(text_value_list=[{'value': '1', 'text': '籃球', },
                                                                                 {'value': '2', 'text': '足球', },
                                                                                 {'value': '3', 'text': '乒乓球', },
                                                                                 {'value': '4', 'text': '羽毛球'}, ]))

            select_str_val_default = StringListField(error={'required': '請選擇愛好', 'invalid': '選擇愛好格式錯誤'},
                                                     widget=MultiSelect(text_value_list=[{'value': '1', 'text': '籃球', },
                                                                                         {'value': '2', 'text': '足球', },
                                                                                         {'value': '3', 'text': '乒乓球', },
                                                                                         {'value': '4', 'text': '羽毛球'}, ],
                                                                        selected_value_list=['1', '3']))

            select_int_val = IntegerListField(error={'required': '請選擇愛好', 'invalid': '選擇愛好格式錯誤'},
                                              widget=MultiSelect(text_value_list=[{'value': 1, 'text': '籃球', },
                                                                                  {'value': 2, 'text': '足球', },
                                                                                  {'value': 3, 'text': '乒乓球', },
                                                                                  {'value': 4, 'text': '羽毛球'}, ]))

            select_int_val_default = IntegerListField(error={'required': '請選擇愛好', 'invalid': '選擇愛好格式錯誤'},
                                                      widget=MultiSelect(text_value_list=[{'value': 1, 'text': '籃球', },
                                                                                          {'value': 2, 'text': '足球', },
                                                                                          {'value': 3, 'text': '乒乓球', },
                                                                                          {'value': 4, 'text': '羽毛球'}, ],
                                                                         selected_value_list=[2]))
      

d. 動态select選項

class DynamicSelectForm(Form):
            city = IntegerField(error={'required': '年齡不能為空', 'invalid': '年齡必須為數字'},
                                widget=SingleSelect(text_value_list=[{'value': 1, 'text': '上海'},
                                                                     {'value': 2, 'text': '北京'},
                                                                     {'value': 3, 'text': '廣州'}])
                                )

            multi_favor = IntegerListField(error={'required': '請選擇愛好', 'invalid': '選擇愛好格式錯誤'},
                                           widget=MultiSelect(text_value_list=[{'value': 1, 'text': '籃球', },
                                                                               {'value': 2, 'text': '足球', },
                                                                               {'value': 3, 'text': '乒乓球', },
                                                                               {'value': 4, 'text': '羽毛球'}, ]))

            def __init__(self, *args, **kwargs):
                super(DynamicSelectForm, self).__init__(*args, **kwargs)

                # 擷取資料庫中的最新資料并顯示在頁面上(每次建立對象都執行一次資料庫操作來擷取最新資料)
                self.city.widget.text_value_list = [{'value': 1, 'text': '上海'},
                                                    {'value': 2, 'text': '北京'},
                                                    {'value': 3, 'text': '南京'},
                                                    {'value': 4, 'text': '廣州'}]

                self.multi_favor.widget.text_value_list = [{'value': 1, 'text': '籃球'},
                                                           {'value': 2, 'text': '足球'},
                                                           {'value': 3, 'text': '乒乓球'},
                                                           {'value': 4, 'text': '羽毛球'},
                                                           {'value': 5, 'text': '玻璃球'}]
      

寫在最後

開源元件持續更新中,如您在使用過程中遇到任何問題,請留言,我将盡快回複!!!

Tyrion技術交流QQ群:564068039

重要的事情說三遍....

...

......

.........

............

.................  

Tyrion中文文檔(含示例源碼)

作者:武沛齊

出處:http://www.cnblogs.com/wupeiqi/

本文版權歸作者和部落格園共有,歡迎轉載,但未經作者同意必須保留此段聲明,且在文章頁面明顯位置給出原文連接配接。