study-together

1.新建立js文件如图

 

 2.写入相关方法并经行测试

 

 

const formatTime = date => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()
  return `${[year, month, day].map(formatNumber).join(\'/\')} ${[hour, minute, second].map(formatNumber).join(\':\')}`
}

const formatNumber = n => {
  n = n.toString()
  return n[1] ? n : `0${n}`
}

function test(params) {
  console.log(123);
}


module.exports = {
  formatTime,
  test
}

3.测试继承

const util = require(\'../../utils/util\');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    wx_login_title:\'微信一键登陆\',
    phone_title:\'手机号码登陆\'
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    util.test();
  },
  wx_login_botton: function(e){
    const url = \'/pages/index/index\';
    getApp().authgetuserinfo(url);//微信登陆后
  },
  phone_login_botton: function(e){
    console.log(this.data.phone_title);
    wx.navigateTo({
      url: \'/pages/login/phone/phone_login?id=1\'
    })
  }
})

 

 

4.测试调用

 

分类:

技术点:

相关文章:

  • 2021-11-03
  • 2021-12-08
  • 2021-11-03
  • 2021-11-23
  • 2021-11-04
  • 2021-11-04
猜你喜欢
  • 2021-11-03
  • 2021-12-08
  • 2021-12-08
  • 2021-12-08
  • 2021-11-03
  • 2021-12-13
  • 2021-10-01
相关资源
相似解决方案