租房掌柜微信小程序Api以及小程序前端模板
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

167 lines
3.0 KiB

// pages/test/index.js
Page({
/**
* 页面的初始数据
*/
data: {
msg: "aaaa",
list: {
array: [1, 2, 3, 4, 5]
},
staffA: {
firstName: 'Hulk',
lastName: 'Hu'
},
staffB: {
firstName: 'Shang',
lastName: 'You'
},
staffC: {
firstName: 'Gideon',
lastName: 'Lin'
},
a: 1,
b: 2,
list_data: [{
'id': 1,
"name": "云掌财经",
"create_time": "2019-08-02"
},
{
'id': 2,
"name": "新世界",
"create_time": "2019-08-05"
}
],
objectArray: [{
id: 5,
unique: 'unique_5'
},
{
id: 4,
unique: 'unique_4'
},
{
id: 3,
unique: 'unique_3'
},
{
id: 2,
unique: 'unique_2'
},
{
id: 1,
unique: 'unique_1'
},
{
id: 0,
unique: 'unique_0'
},
],
numberArray: [1, 2, 3, 4]
},
switch: function(e) {
const length = this.data.objectArray.length
for (let i = 0; i < length; ++i) {
const x = Math.floor(Math.random() * length)
const y = Math.floor(Math.random() * length)
console.log(x, y)
console.log(this.data.objectArray[x])
const temp = this.data.objectArray[x]
this.data.objectArray[x] = this.data.objectArray[y]
this.data.objectArray[y] = temp
}
this.setData({
objectArray: this.data.objectArray
})
},
addToFront: function(e) {
const length = this.data.objectArray.length;
this.data.objectArray = [{
'id': length,
unique: 'unique_' + length
}].concat(this.data.objectArray);
this.setData({
objectArray: this.data.objectArray
})
},
addNumberToFront: function(e) {
this.data.numberArray = [this.data.numberArray.length + 1].concat(this.data.numberArray)
this.setData({
numberArray: this.data.numberArray
})
},
getname:function(e){
//获取data数据
console.log(e.currentTarget.dataset.name);
console.log(e.currentTarget.dataset.nameKey);
console.log(e.currentTarget.dataset.namevalue);
},
bindViewTap: function (e) {
console.log(e.mark.myMark) // true
console.log(e.mark.anotherMark) // true
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.setData({
msg: "bbbbb"
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})