import globalDataBehavior from "../../behaviors/globaldata-behavior" ; import autologBehavior from "../../behaviors/autolog-behavior" ; const PAGE_NAME = "form" ; Component ( { behaviors : [ globalDataBehavior , autologBehavior ] , data : { PAGE_NAME , qq : "" , date : "2016-09-01" , phone : "" , countryCodes : [ "+86" , "+80" , "+84" , "+87" ] , countryCodeIndex : 0 , isAgree : false } , methods : { saveToGlobalData ( e ) { const { toStorage } = e . currentTarget . dataset ; const { date , countryCodeIndex , qq , phone , isAgree } = this . data ; const data = { date , countryCodeIndex , qq , phone , isAgree } ; if ( toStorage ) { ( this as any ) . setGlobalDataAndStorage ( data ) ; } else { ( this as any ) . setGlobalData ( data ) ; } } , getGlobalData ( ) { const { date , countryCodeIndex , qq , phone , isAgree } = this . data . globalData || ( { } as any ) ; this . setData ( { date , countryCodeIndex , qq , phone , isAgree } ) ; } , formItemChange ( e ) { const { field } = e . currentTarget . dataset ; this . setData ( { [ `${ field }` ] : e . detail . value } ) ; } , bindAgreeChange : function ( e ) { this . setData ( { isAgree : ! ! e . detail . value . length } ) ; } } } ) ;