parent
2d283721a0
commit
6574547025
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Eslint config file
|
||||
* Documentation: https://eslint.org/docs/user-guide/configuring/
|
||||
* Install the Eslint extension before using this feature.
|
||||
*/
|
||||
module.exports = {
|
||||
env: {
|
||||
es6: true,
|
||||
browser: true,
|
||||
node: true,
|
||||
},
|
||||
ecmaFeatures: {
|
||||
modules: true,
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 2018,
|
||||
sourceType: 'module',
|
||||
},
|
||||
globals: {
|
||||
wx: true,
|
||||
App: true,
|
||||
Page: true,
|
||||
getCurrentPages: true,
|
||||
getApp: true,
|
||||
Component: true,
|
||||
requirePlugin: true,
|
||||
requireMiniProgram: true,
|
||||
},
|
||||
// extends: 'eslint:recommended',
|
||||
rules: {},
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
// app.js
|
||||
App({
|
||||
onLaunch() {
|
||||
// 展示本地存储能力
|
||||
const logs = wx.getStorageSync('logs') || []
|
||||
logs.unshift(Date.now())
|
||||
wx.setStorageSync('logs', logs)
|
||||
|
||||
// 登录
|
||||
wx.login({
|
||||
success: res => {
|
||||
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
||||
}
|
||||
})
|
||||
},
|
||||
globalData: {
|
||||
userInfo: null
|
||||
}
|
||||
})
|
@ -0,0 +1,15 @@
|
||||
{
|
||||
"pages": [
|
||||
"pages/logs/logs",
|
||||
"pages/index/index"
|
||||
],
|
||||
"window": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "Weixin",
|
||||
"navigationBarBackgroundColor": "#ffffff"
|
||||
},
|
||||
"style": "v2",
|
||||
"componentFramework": "glass-easel",
|
||||
"sitemapLocation": "sitemap.json",
|
||||
"lazyCodeLoading": "requiredComponents"
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
/**app.wxss**/
|
||||
.container {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 200rpx 0;
|
||||
box-sizing: border-box;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
Page({
|
||||
data:{
|
||||
message:"Hello world",
|
||||
num:1,
|
||||
condition:true,
|
||||
count:46,
|
||||
true:true, //111
|
||||
hidden:false
|
||||
},
|
||||
|
||||
compare:function(e){
|
||||
// console.log("比较对象被点击了") //测试是否绑定成功
|
||||
console.log(e)
|
||||
},
|
||||
|
||||
viewtap:function(e){
|
||||
console.log(e.target.id+'-'+e.currentTarget.id)
|
||||
},
|
||||
test(){
|
||||
console.log('test()函数执行了')
|
||||
},
|
||||
onLoad(){
|
||||
console.log(this.data.num)
|
||||
this.test()
|
||||
},
|
||||
changeText(){
|
||||
this.setData({
|
||||
message:'Hello Mayday!'
|
||||
})
|
||||
},
|
||||
})
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<view bind:tap="changeText">{{message}}</view>
|
||||
<button bind:tap="compare">比较</button>
|
||||
<view id="outer" bind:tap="viewtap">
|
||||
outer
|
||||
<view id="inner" >
|
||||
inner
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{condition}}">陈信宏</view>
|
||||
|
||||
<!-- 三者显示一个 -->
|
||||
<view wx:if="{{count<1}}">0</view>
|
||||
<view wx:elif="{{count==1}}">1</view>
|
||||
<view wx:else>2</view>
|
||||
<block wx:if="{{true}}">
|
||||
<view>view1</view>
|
||||
<view>view2</view>
|
||||
</block>
|
||||
|
||||
|
||||
<text hidden="{{hidden}}">hidden为true不显示</text>
|
@ -0,0 +1,62 @@
|
||||
/**index.wxss**/
|
||||
page {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.scrollarea {
|
||||
flex: 1;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
.userinfo {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
color: #aaa;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.userinfo-avatar {
|
||||
overflow: hidden;
|
||||
width: 128rpx;
|
||||
height: 128rpx;
|
||||
margin: 20rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.usermotto {
|
||||
margin-top: 200px;
|
||||
}
|
||||
|
||||
.avatar-wrapper {
|
||||
padding: 0;
|
||||
width: 56px !important;
|
||||
border-radius: 8px;
|
||||
margin-top: 40px;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
display: block;
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
}
|
||||
|
||||
.nickname-wrapper {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
padding: 16px;
|
||||
box-sizing: border-box;
|
||||
border-top: .5px solid rgba(0, 0, 0, 0.1);
|
||||
border-bottom: .5px solid rgba(0, 0, 0, 0.1);
|
||||
color: black;
|
||||
}
|
||||
|
||||
.nickname-label {
|
||||
width: 105px;
|
||||
}
|
||||
|
||||
.nickname-input {
|
||||
flex: 1;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
Page({
|
||||
num1:0,
|
||||
num2:0,
|
||||
data:{
|
||||
result:''
|
||||
},
|
||||
input1(e){
|
||||
this.num1=Number(e.detail.value)
|
||||
},
|
||||
input2(e){
|
||||
this.num2=Number(e.detail.value)
|
||||
},
|
||||
compare(){
|
||||
var str=''
|
||||
if(this.num1>this.num2){
|
||||
str='第一个数大'
|
||||
}else if(this.num1<this.num2){
|
||||
str='第二个数大'
|
||||
}else{
|
||||
str='一样大'
|
||||
}
|
||||
this.setData({
|
||||
result:str
|
||||
})
|
||||
}
|
||||
})
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "比较数字大小"
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<view>
|
||||
<text>请输入第一个数字:</text>
|
||||
<input type="number" bindinput="input1"/>
|
||||
</view>
|
||||
<view>
|
||||
<text>请输入第二个数字:</text>
|
||||
<input type="number" bindinput="input2"/>
|
||||
</view>
|
||||
<button bind:tap="compare">比较</button>
|
||||
<view class="jg"><text wx:if="{{result}}">比较结果:{{result}}</text></view>
|
@ -0,0 +1,18 @@
|
||||
text{
|
||||
font-size: 3vh;
|
||||
display: block;
|
||||
margin-bottom: 2vh;
|
||||
}
|
||||
input{
|
||||
border: 3px solid lightblue;
|
||||
height: 5vh;
|
||||
}
|
||||
button{
|
||||
background-color: lightblue;
|
||||
margin-top: 3vh;
|
||||
}
|
||||
.jg{
|
||||
text-align: center;
|
||||
font-size: 3vh;
|
||||
margin-top: 2vh;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
{
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "trial",
|
||||
"packOptions": {
|
||||
"ignore": [],
|
||||
"include": []
|
||||
},
|
||||
"setting": {
|
||||
"coverView": true,
|
||||
"es6": true,
|
||||
"postcss": true,
|
||||
"minified": true,
|
||||
"enhance": true,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"packNpmRelationList": [],
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
}
|
||||
},
|
||||
"condition": {},
|
||||
"editorSetting": {
|
||||
"tabIndent": "auto",
|
||||
"tabSize": 2
|
||||
},
|
||||
"appid": "wxc15fead6ca65fb7b"
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
|
||||
"rules": [{
|
||||
"action": "allow",
|
||||
"page": "*"
|
||||
}]
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
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}`
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
formatTime
|
||||
}
|
Loading…
Reference in new issue