最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

使用微信小程序開發(fā)彈出框應(yīng)用實例詳解

 更新時間:2018年10月18日 15:20:00   作者:面條請不要欺負漢堡  
本文通過實例代碼給大家介紹了使用微信小程序開發(fā)彈出框功能,代碼簡單易懂,非常不錯,具有一定的參考借鑒價值,需要的朋友可以參考下

view class="container" class="zn-uploadimg">	
<button type="primary"bindtap="showok">消息提示框</button> 	
<button type="primary"bindtap="modalcnt">模態(tài)彈窗</button> 	
<button type="primary"bindtap="actioncnt">操作菜單</button>
 </view>

1.消息提示——wx.showToast(OBJECT)

//show.js
//獲取應(yīng)用實例 
var app = getApp() 
Page({
	showok:function() {
		wx.showToast({
		 	title: '成功',
		 	icon: 'success',
		 	duration: 2000
		})
	}
})

2.模態(tài)彈窗——wx.showModal(OBJECT)

//show.js
//獲取應(yīng)用實例 
var app = getApp() 
Page({
	showok:function() {
		wx.showToast({
		 	title: '成功',
		 	icon: 'success',
		 	duration: 2000
		})
	}
})

//show.js
//獲取應(yīng)用實例 
var app = getApp() 
Page({
	modalcnt:function(){
		wx.showModal({
			title: '提示',
			content: '這是一個模態(tài)彈窗',
			success: function(res) {
				if (res.confirm) {
				console.log('用戶點擊確定')
				} else if (res.cancel) {
				console.log('用戶點擊取消')
				}
			}
		})
	}
})

3.操作菜單——wx.showActionSheet(OBJECT)

//show.js
//獲取應(yīng)用實例 
var app = getApp() 
Page({
	actioncnt:function(){
		wx.showActionSheet({
			itemList: ['A', 'B', 'C'],
			success: function(res) {
				console.log(res.tapIndex)
			},
			fail: function(res) {
				console.log(res.errMsg)
			}
		})
	}
})

4.指定modal彈出

指定哪個modal,可以通過hidden屬性來進行選擇。

<!--show.wxml-->
<view class="container" class="zn-uploadimg">	
<button type="primary"bindtap="modalinput">
modal有輸入框
</button> 
</view>
<modal hidden="{{hiddenmodalput}}" title="請輸入驗證碼" confirm-text="提交" cancel-text="重置" bindcancel="cancel" bindconfirm="confirm"> 
 <input type='text'placeholder="請輸入內(nèi)容" auto-focus/>
</modal>
//show.js 
//獲取應(yīng)用實例 
var app = getApp() 
Page({
	data:{
  hiddenmodalput:true,
  //可以通過hidden是否掩藏彈出框的屬性,來指定那個彈出框
 },
	//點擊按鈕痰喘指定的hiddenmodalput彈出框
	modalinput:function(){
		this.setData({
		 hiddenmodalput: !this.data.hiddenmodalput
		})
	},
	//取消按鈕
	cancel: function(){
  this.setData({
   hiddenmodalput: true
  });
 },
 //確認
 confirm: function(){
  this.setData({
	  hiddenmodalput: true
	 })
 }
})

總結(jié)

以上所述是小編給大家介紹的使用微信小程序開發(fā)彈出框應(yīng)用實例詳解,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評論

阜新| 临江市| 大同市| 淮滨县| 社会| 那坡县| 宿迁市| 朝阳区| 阳信县| 和政县| 武宁县| 水富县| 宝清县| 荥经县| 英吉沙县| 开阳县| 灵武市| 静乐县| 横峰县| 大竹县| 平潭县| 高州市| 新兴县| 阳山县| 电白县| 泽库县| 洪雅县| 嘉荫县| 页游| 合江县| 偏关县| 石狮市| 西城区| 栾城县| 平远县| 岳普湖县| 南溪县| 明星| 辽阳市| 赤壁市| 沙湾县|