国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 熱點 > 微信 > 正文

詳解微信小程序的不同函數調用的幾種方法

2024-07-22 01:18:32
字體:
來源:轉載
供稿:網友

一、調取參數

直接調取當前js中的方法,

調取參數that.bindViewTap();

二、跳轉頁面

navigateTo: function () {wx.navigateTo({ url: '../page4/page4' });},  全局變量使用方法a.jsvar app = getApp()Page({data: {hex1: [],})}//設置全局變量if (hex1 != null) {app.globalData.hex1 = hex1;} b.js接收全局變量var app = getApp()Page({ data:{  hex1:[] }, onLoad:function(options){   this.setData({   hex1:getApp().globalData.hex1  }); }, })

三、獲取事件的方法:

獲取事件的方法:bindViewTap1: function (e) {console.log('事件event',e)} 監聽input方法a.wxml頁面<input type="number" maxlength="2" placeholder="小于100分鐘" placeholder-class="psection" bindinput="listenerTimeInput" /> a.js頁面//監聽input框輸入listenerTimeInput: function (e) {this.data.time = e.detail.value;console.log('噠噠this.data.time', this.data.time)}, 獲取當前時間戳var timestamp = Date.parse(new Date());timestamp = timestamp / 1000;console.log("當前時間戳為:" + timestamp); 時間轉換為秒var stime = '';var format = '';stime = time * 60;console.log('秒', stime); 轉換為時間Date.prototype.format = function (format) {var date = {"M+": this.getMonth() +1,"d+": this.getDate(),"h+": this.getHours(),"m+": this.getMinutes(),"s+": this.getSeconds(),"q+": Math.floor((this.getMonth() +3) /3),"S+": this.getMilliseconds()};if (/(y+)/i.test(format)) {format = format.replace(RegExp.$1, (this.getFullYear() +'').substr(4 - RegExp.$1.length));}for (var kin date) {if (new RegExp("(" + k +")").test(format)) {format = format.replace(RegExp.$1, RegExp.$1.length == 1? date[k] : ("00" + date[k]).substr(("" + date[k]).length));}}return format;}var oktime = '';oktime = newDate.format('yyyy-MM-dd h:m:s'); //獲取當前時間var date = new Date();var seperator1 = "-";var seperator2 = ":";var month = date.getMonth() + 1;console.log('大大', month);var strDate = date.getDate();if (month >= 1 && month <= 9) {month = "0" + month;}console.log('大大', month);if (strDate >= 0 && strDate <= 9) {strDate = "0" + strDate;}var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate + " " + date.getHours() + seperator2 + date.getMinutes() + seperator2 + date.getSeconds();console.log('當前時間', currentdate);console.log('年', date.getFullYear());console.log('月', month);console.log('日', date.getDate());console.log('時', date.getHours())console.log('分', date.getMinutes())  轉為串oktime = oktime.toString(); 提取數值var oktime = oktime.replace(/[^0-9]/ig, "");console.log('oktime', oktime); 獲取年 月 日 時 分 秒var year1 = '';var month1 ='';var date1 ='';var hours1 ='';var min1 ='';year1 = oktime.substring(2, 4);console.log('year1', year1);month1 = oktime.substring(4, 6);console.log('month1', month1);date1 = oktime.substring(6, 8);console.log('date1', date1);hours1 = oktime.substring(8, 10);console.log('hours1', hours1);min1 = oktime.substring(10, 12);console.log('min1', min1); 轉換為16進制  var zhen4000 = parseInt(zhen400);  console.log('飛zhen4000', zhen4000)    zhen4000 = zhen4000.toString(16); console.log('@@@@@zhen4000', zhen4000); 將值由16進制轉10進制zhen1 = parseInt(zhen001, 16); // 進行異或運算//注:我使用過16進制的異或運算,沒成功,最后使用了比較復雜的方法,由十六進制轉化為十進制異或運算,將得到的值在轉為十六進制zhen9 = zhen1 ^ zhen2            
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 邻水| 阿合奇县| 渭南市| 纳雍县| 德惠市| 富川| 美姑县| 丽水市| 定南县| 克东县| 临沂市| 卢氏县| 建阳市| 和静县| 永胜县| 尚志市| 丰城市| 玉林市| 山阴县| 炉霍县| 阿克| 石狮市| 剑川县| 比如县| 澄江县| 丹巴县| 来宾市| 桂林市| 彭山县| 定远县| 临海市| 罗源县| 新宾| 乡城县| 冀州市| 桂林市| 淄博市| 洪泽县| 合肥市| 沧州市| 和硕县|