123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- const app = getApp()
- Page({
- onShareAppMessage() {
- return {
- title: 'swiper',
- path: 'page/component/pages/swiper/swiper'
- }
- },
- /**
- * 页面的初始数据
- */
- data: {
- frameStyle: { useTop: true, name: '练习', leftArrow: true, useBar: false},
- // 主体高度
- infoHeight: '',
- latitude: 23.099994,
- longitude: 113.324520,
- x: 0,
- y: 0,
- scale: 2,
- background: ['demo-text-1', 'demo-text-2', 'demo-text-3'],
- indicatorDots: true,
- vertical: false,
- autoplay: false,
- interval: 2000,
- duration: 500,
- iconSize: [20, 30, 40, 50, 60, 70],
- iconColor: [
- 'red', 'orange', 'yellow', 'green', 'rgb(0,255,255)', 'blue', 'purple'
- ],
- iconType: [
- 'success', 'success_no_circle', 'info', 'warn', 'waiting', 'cancel', 'download', 'search', 'clear'
- ],
- chosen: '',
- focus: false,
- inputValue: '',
- checkboxItems: [
- {name: 'USA', value: '美国'},
- {name: 'CHN', value: '中国', checked: 'true'}
- ],
- radioItems: [
- {name: 'USA', value: '美国'},
- {name: 'CHN', value: '中国', checked: 'true'}
- ],
- hidden: false,
- height: 20,
- focus: false
- },
- bindButtonTap: function() {
- this.setData({
- focus: true
- })
- },
- bindTextAreaBlur: function(e) {
- console.log(e.detail.value)
- },
- bindFormSubmit: function(e) {
- console.log(e.detail.value.textarea)
- },
- radioChange(e) {
- const checked = e.detail.value
- const changed = {}
- for (let i = 0; i < this.data.radioItems.length; i++) {
- if (checked.indexOf(this.data.radioItems[i].name) !== -1) {
- changed['radioItems[' + i + '].checked'] = true
- } else {
- changed['radioItems[' + i + '].checked'] = false
- }
- }
- this.setData(changed)
- },
- bindKeyInput: function (e) {
- this.setData({
- inputValue: e.detail.value
- })
- },
- changeIndicatorDots() {
- this.setData({
- indicatorDots: !this.data.indicatorDots
- })
- },
- formReset(e) {
- console.log('form发生了reset事件,携带数据为:', e.detail.value)
- this.setData({
- chosen: ''
- })
- },
- changeAutoplay() {
- this.setData({
- autoplay: !this.data.autoplay
- })
- },
- intervalChange(e) {
- this.setData({
- interval: e.detail.value
- })
- },
- durationChange(e) {
- this.setData({
- duration: e.detail.value
- })
- },
- tap() {
- this.setData({
- x: 30,
- y: 30
- })
- },
- tap2() {
- this.setData({
- scale: 3
- })
- },
- onChange(e) {
- console.log(e.detail)
- },
- onScale(e) {
- console.log(e.detail)
- },
- back: function () {
- wx.navigateBack({ url: '/pages/home/index' })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function () {
- // 计算高度
- this.searchHeight()
- },
- // 计算高度
- searchHeight: function () {
- let frameStyle = this.data.frameStyle;
- let client = app.globalData.client;
- // 减去状态栏
- let infoHeight = client.windowHeight - (client.statusBarHeight + client.getMenu.height + (client.getMenu.top - client.statusBarHeight) * 2);
- // 是否减去底部菜单
- if (frameStyle.useBar) infoHeight = infoHeight - 50;
- if (infoHeight) this.setData({ infoHeight: infoHeight })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|