1.Hbuilder的代碼塊設(shè)置

#此處為方春高自己定義的代碼塊,主要是為了方便操作

# 消息框? ============================

#提示框

snippet 'dongyi.prompt() 提示框' do |s|

s.trigger = "ca_pro"

s.expansion = "dongyi.prompt(\"$1\") "

s.needApplyReContentAssist = true

end

#警告框=======

snippet 'dongyi.alert() 警告框' do |s|

s.trigger = "ca_alert"

s.expansion = "dongyi.alert({

title: \"$1\",

content:\"$0\",

callback:function(){

alert('點(diǎn)擊了');

}

}); "

s.needApplyReContentAssist = true

end

#確認(rèn)框=======

snippet 'dongyi.confirmt() 確認(rèn)框' do |s|

s.trigger = "ca_confirm"

s.expansion = "dongyi.confirm({

title:\"$1\",

content:\"$0\",

callback:function(data){

alert(data);

}

}); "

s.needApplyReContentAssist = true

end

#輸入框=======

snippet 'dongyi.inputPrompt() 輸入框' do |s|

s.trigger = "ca_inputPrompt"

s.expansion = "dongyi.inputPrompt({

title:\"$1\",

content:\"$0\",

callback:function(data){

alert(data);

}

});"

s.needApplyReContentAssist = true

end

#日期選擇框=======

snippet 'dongyi.dateSelect() 日期選擇框' do |s|

s.trigger = "ca_dateSelect"

s.expansion = "dongyi.dateSelect({

defaultTime:'2015-10-1',

minTime:'2000-1-1',

maxTime:'2020-1-1',

callback:function(date){

alert(date);

}

});"

s.needApplyReContentAssist = true

end

#時(shí)間選擇框=======

snippet 'dongyi.timeSelect 時(shí)間選擇框' do |s|

s.trigger = "ca_timeSelect"

s.expansion = "dongyi.timeSelect({

defaultTime:'18:00',

callback:function(date){

alert(date);

}

});"

s.needApplyReContentAssist = true

end

#電話 =======

snippet 'dongyi.callPhone 電話' do |s|

s.trigger = "ca_callPhone"

s.expansion = "dongyi.callPhone('13800138000');"

s.needApplyReContentAssist = true

end

#郵件 =======

snippet 'dongyi.sendEmail 郵件' do |s|

s.trigger = "ca_sendEmail"

s.expansion = "dongyi.sendEmail('dongyixueyuan@qq.com');"

s.needApplyReContentAssist = true

end

#瀏覽器打開網(wǎng)頁(yè)? =======

snippet 'dongyi.openUrl 瀏覽器打開網(wǎng)頁(yè) ' do |s|

s.trigger = "ca_openUrl"

s.expansion = "dongyi.openUrl('http://www.dongyixueyuan.com');"

s.needApplyReContentAssist = true

end

#短信? =======

snippet 'dongyi.sendSms 短信 ' do |s|

s.trigger = "ca_sendSms"

s.expansion = "var targetPhone = ['13800138000','138001380001'];

dongyi.sendSms(targetPhone,'短信內(nèi)容');"

s.needApplyReContentAssist = true

end

#雙擊退出APP? =======

snippet 'dongyi.dblclickExit 雙擊退出APP(安卓) ' do |s|

s.trigger = "ca_dblclickExit"

s.expansion = "dongyi.dblclickExit();"

s.needApplyReContentAssist = true

end

#隱藏滾動(dòng)條? ? =======

snippet 'dongyi.hiddenScroll 隱藏滾動(dòng)條 ' do |s|

s.trigger = "ca_hiddenScroll"

s.expansion = "dongyi.hiddenScroll();"

s.needApplyReContentAssist = true

end

#蜂鳴提示音? ? =======

snippet 'dongyi.beep 蜂鳴提示音 ' do |s|

s.trigger = "ca_beep"

s.expansion = "dongyi.beep();"

s.needApplyReContentAssist = true

end

#手機(jī)震動(dòng)? ? =======

snippet 'dongyi.vibrate 手機(jī)震動(dòng) ' do |s|

s.trigger = "ca_vibrate"

s.expansion = "dongyi.vibrate();"

s.needApplyReContentAssist = true

end

#遮罩? ? =======

snippet 'dongyi.showMask 遮罩 ' do |s|

s.trigger = "ca_showMask"

s.expansion = "dongyi.showMask(function(){

alert('callback');

});"

s.needApplyReContentAssist = true

end

#預(yù)加載? ? =======

snippet 'dongyi.preLoad 界面預(yù)加載 ' do |s|

s.trigger = "ca_preLoad"

s.expansion = "var arrayData = [{url:'first.html',id:'first'},{url:'second.html',id:'second'}];

dongyi.preLoad(arrayData,function(data){

alert(data);

});"

s.needApplyReContentAssist = true

end

#等待框顯示? ? =======

snippet 'dongyi.showWaiting 等待框顯示 ' do |s|

s.trigger = "ca_showWaiting"

s.expansion = "dongyi.showWaiting('等待框...');"

s.needApplyReContentAssist = true

end

#等待框關(guān)閉? ? =======

snippet 'dongyi.closeWaiting 等待框關(guān)閉 ' do |s|

s.trigger = "ca_closeWaiting"

s.expansion = "dongyi.closeWaiting();"

s.needApplyReContentAssist = true

end

#打開新界面? ? =======

snippet 'dongyi.newInterface 打開新界面? ' do |s|

s.trigger = "ca_newInterface"

s.expansion = "dongyi.newInterface({

url:'child.html',

id:'child',

styles:{

top:'0px',

bottom:'',

width:'',

height:''

},

showType:'zoom-fade-out',

showTime:200

});"

s.needApplyReContentAssist = true

end

#關(guān)閉當(dāng)前界面? ? =======

snippet 'dongyi.closeCurrentInterface 關(guān)閉當(dāng)前界面 ' do |s|

s.trigger = "ca_closeCurrentInterface"

s.expansion = "dongyi.closeCurrentInterface();"

s.needApplyReContentAssist = true

end

#創(chuàng)建子頁(yè)面? ? ? =======

snippet 'dongyi.createChildInterface 創(chuàng)建子頁(yè)面 ' do |s|

s.trigger = "ca_createChildInterfacee"

s.expansion = "dongyi.createChildInterface({

url:'child.html',

id:'child',

styles:{

top:'44px',

bottom:'',

width:'',

height:'',

}

});"

s.needApplyReContentAssist = true

end

#獲得起始頁(yè)對(duì)象? ? ? =======

snippet 'dongyi.getStartInterface 獲得起始頁(yè)對(duì)象? ' do |s|

s.trigger = "ca_getStartInterface"

s.expansion = "dongyi.getStartInterface(function(startObject){

alert(startObject.getURL());

});"

s.needApplyReContentAssist = true

end

#獲得當(dāng)前界面對(duì)象? ? ? =======

snippet 'dongyi.getCurrentInterface 獲得當(dāng)前界面對(duì)象? ' do |s|

s.trigger = "ca_getCurrentInterface"

s.expansion = "dongyi.getCurrentInterface(function(currentObject){

alert(currentObject.getURL());

});"

s.needApplyReContentAssist = true

end

#獲得目標(biāo)界面對(duì)象? ? =======

snippet 'dongyi.getTargetInterface 獲得目標(biāo)界面對(duì)象? ' do |s|

s.trigger = "ca_getTargetInterface"

s.expansion = "dongyi.getTargetInterface('first',function(targetObject){

alert(targetObject.getURL());

});"

s.needApplyReContentAssist = true

end

#actionSheet? ? =======

snippet 'dongyi.actionSheet actionSheet? ' do |s|

s.trigger = "ca_actionSheet"

s.expansion = "var arr = [{'title':'打開相冊(cè)'},{'title':'打開相機(jī)'}];

var arr = ['新浪微博','騰訊微博','搜狐微博'];

// 兩種寫法均可

dongyi.actionSheet(arr,{

succFn:function(data){

alert(data);

},

errFn:function(data){

alert(data);

}

})"

s.needApplyReContentAssist = true

end

#相冊(cè)? ? =======

snippet 'dongyi.album 相冊(cè)? ' do |s|

s.trigger = "ca_album"

s.expansion = "dongyi.album({

succFn:function(path){

alert(path);

},

errFn:function(error){

alert(error);

}

});"

s.needApplyReContentAssist = true

end

#照相機(jī)? ? =======

snippet 'dongyi.camera 照相機(jī)? ' do |s|

s.trigger = "ca_camera"

s.expansion = "dongyi.camera({

succFn:function(path,name){

alert(path); // 圖片路徑

alert(name); // 圖片名稱

},

errFn:function(error){

alert(error);

}

});"

s.needApplyReContentAssist = true

end

#相冊(cè)? ? =======

snippet 'dongyi.album 相冊(cè)? ' do |s|

s.trigger = "ca_album"

s.expansion = "dongyi.album({

succFn:function(path){

alert(path);

},

errFn:function(error){

alert(error);

}

});"

s.needApplyReContentAssist = true

end

#獲得通訊錄信息? ? =======

snippet 'dongyi.getAddressBook 獲得通訊錄信息? ' do |s|

s.trigger = "ca_getAddressBook"

s.expansion = "dongyi.getAddressBook('phone',function(listData,length){

for(var a=0;a Z

var firstLetter = json.firstLetter;

}

});"

s.needApplyReContentAssist = true

end

# post請(qǐng)求

snippet 'dongyi.get()' do |s|? ? ? ? ? ? #document.createElement()是顯示名稱,代碼助手提示列表顯示時(shí)可見(jiàn)

s.trigger = "ca_get"? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? #dc是激活字符,即按下dc后會(huì)觸發(fā)該代碼塊

s.expansion = "dongyi.get({

url:'http://student.dongyixueyuan.com/link_app/get',

data:{

state:'index'

},

succFn:function(data){

alert(data);

}}

);"? #expansion是代碼塊的輸出內(nèi)容,其中$0、$1是光標(biāo)的停留和切換位置。$1是第一個(gè)停留光標(biāo),$0是最后回車時(shí)停留的光標(biāo)。

#如果輸出涉及到換行和tab,也需嚴(yán)格在這里使用換行和tab。

#輸出雙引號(hào)在前面加\來(lái)轉(zhuǎn)義,輸出$使用\$(單引號(hào)中)或\\$(雙引號(hào)中)轉(zhuǎn)義

s.needApplyReContentAssist = true? ? ? ? ? ? ? ? ? #這句話的意思是輸出后同時(shí)激活代碼助手,即在$1的位置直接拉出標(biāo)簽列表

end

#get請(qǐng)求? ? =======

snippet 'dongyi.get get請(qǐng)求? ' do |s|

s.trigger = "ca_get"

s.expansion = "dongyi.get({

url:'http://student.dongyixueyuan.com/link_app/get',

data:{

state:'index'

},

succFn:function(data){

alert(data);

}}

);"

s.needApplyReContentAssist = true

end

#設(shè)備信息? ? =======

snippet 'dongyi.getDeviceInfo 設(shè)備信息? ? ' do |s|

s.trigger = "ca_getDeviceInfo"

s.expansion = "dongyi.getDeviceInfo(function(json){

for(var a in json){

alert(a+'='+json[a]);

}

});"

s.needApplyReContentAssist = true

end

#手機(jī)信息? ? =======

snippet 'dongyi.getMachineInfo 手機(jī)信息? ? ' do |s|

s.trigger = "ca_getMachineInfo"

s.expansion = "dongyi.getMachineInfo(function(json){

for(var a in json){

alert(a+'='+json[a]);

}

});"

s.needApplyReContentAssist = true

end

#地理位置? ? =======

snippet 'dongyi.getCurrentPosition 地理位置? ? ' do |s|

s.trigger = "ca_getCurrentPosition"

s.expansion = "dongyi.getCurrentPosition({

succFn:function(data){

alert(data);

},

errFn:function(error){

alert(error);

}

});"

s.needApplyReContentAssist = true

end

#手勢(shì)? ? ? =======

snippet 'dongyi.gesture 手勢(shì)? ? ' do |s|

s.trigger = "ca_gesture"

s.expansion = "dongyi.gesture(cell['0'],'tap',function(){

alert('我被單擊了');

});"

s.needApplyReContentAssist = true

end

#通知 and 接收通知? ? =======

snippet 'dongyi.sendNotice 通知and 接收通知? ? ' do |s|

s.trigger = "ca_sendNotice"

s.expansion = "var noticeArr = ['root','first','second']; // 通知id數(shù)組

var notice = 'root'; // 通知id單個(gè)字符串

dongyi.sendNotice(noticeArr,'channel',{

name:'東翌學(xué)院'

});

dongyi.receiveNotice('channel',function(event){

var name = event.detail.name;

alert(name);

});"

s.needApplyReContentAssist = true

end

#本地存儲(chǔ)? ? ? =======

snippet 'dongyi.localStorage 本地存儲(chǔ)? ? ' do |s|

s.trigger = "ca_localStorage"

s.expansion = "http://HTML5自帶 - 設(shè)置

localStorage.setItem('鍵','值'); -> localStorage.setItem('name','dongyixueyuan');

//HTML5自帶 - 查詢

localStorage.getItem('鍵'); -> var name = localStorage.setItem('name');

//HTML5自帶 - 刪除

localStorage.removeItem('鍵'); -> localStorage.removeItem('name');

//HTML5自帶 - 清空

localStorage.clear();"

s.needApplyReContentAssist = true

end

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • **2014真題Directions:Read the following text. Choose the be...
    又是夜半驚坐起閱讀 11,055評(píng)論 0 23
  • ¥開啟¥ 【iAPP實(shí)現(xiàn)進(jìn)入界面執(zhí)行逐一顯】 〖2017-08-25 15:22:14〗 《//首先開一個(gè)線程,因...
    小菜c閱讀 7,322評(píng)論 0 17
  • 做飯
    縸縸魚_閱讀 321評(píng)論 0 0
  • 1、審計(jì):據(jù)財(cái)務(wù)郭老師通知,我們審計(jì)時(shí)間從本月20號(hào)開始,時(shí)間很短,請(qǐng)大家抓緊,門店庫(kù)存要做到精準(zhǔn),請(qǐng)大家及時(shí)自查...
    松松勁柏閱讀 214評(píng)論 0 0
  • 是夜,免不了一個(gè)人無(wú)聊,透過(guò)窗戶,看著黑暗的夜空,感嘆著時(shí)光易老。年少時(shí)總是多有愁緒,也不是有多消極,有多感傷,只...
    忽而今夏_閱讀 478評(píng)論 1 4

友情鏈接更多精彩內(nèi)容