河南科技大学19级微信小程序复习资料(大题)

第一题

 

 

// index.js
// 获取应用实例
const app = getApp()

Page({
  data: {
    result:"",
  },
  num1:0,
  num2:0,
  numValue:function(event){
    if(event.target.id=="num1"){
        this.num1=Number(event.detail.value)
    }
    if(event.target.id=="num2"){
        this.num2=Number(event.detail.value)
    }
  },
  compare(){
   if(this.num1>this.num2){
     this.setData({
       result:"第一个数大"
     })
   }else if(this.num1<this.num2){
    this.setData({
      result:"第二个数大"
    })
   }else{
    this.setData({
      result:"两个数相等"
    })
   }
  }
})



第二题

 

 

 

 


<!-- 第一个空 <form ________="formSubmit">-->
<form bindsubmit="formSubmit">
    <view class="content">
        <view> <input name="xm" type="text" placeholder="输入您的姓名:" placeholder-class="phcolor" /> </view>
        <view> <input name="phone" type="text" placeholder="输入您的手机号:" placeholder-class="phcolor" /> </view>
        <view>
        <!--  <picker name="num" ___(2)____="____(3)____" range="{{picker.arr}}"> 参加婚礼人数:_______(4)__________  -->
            <picker name="num" bindchange="pickerChange" range="{{picker.arr}}" value="{{index}}"> 参加婚礼人数:{{picker.arr[index]}}
            </picker>
        </view> 
        <!--   <button form-type="___(5)___">提交</button>-->
        <button form-type="submit">提交</button>
    </view>
</form>
Page({
    data: {
        picker: {
            arr: ['1', '2', '3', '4', '5', '6'],
            index: 0
        }
    },
    pickerChange: function (e) {
        console.log(e)
        this.setData({
            //___6___: e.detail.value 
            index: e.detail.value
        })
    },
    formSubmit: function (e) {
        console.log(e)
        // ___*(7)___
        var name = e.detail.value.xm
        var phone = e.detail.value.phone
        if (name && phone.length == 13) {
            // ______(9) ________({
            wx.showToast({
                title: '提交成功',
                icon: 'success',
                duration: 1500
            })
        } else {
            // ______(10) _______({
            wx.showToast({

                title: '信息错误',
                icon: 'error',
                duration: 1500
            })
        }
    }
})

第三题

 

 

 

 

<view class="tab">
    <view class="tab-item {{item==0?'active':''}}" bindtap="changeItem" id="0">粉色</view>
    <view class="tab-item {{item==1?'active':''}}" bindtap="changeItem"id="1">绿色</view>
    <view class="tab-item {{item==2?'active':''}}" bindtap="changeItem" id="2">蓝色</view>
</view>
<swiper current="{{item}}" circular="true" bindchange="changeTab">
    <swiper-item>
        <view style="background:pink;"></view>
    </swiper-item>
    <swiper-item>
        <view style="background:green;"></view>
    </swiper-item>
    <swiper-item>
        <view style="background:blue;"></view>
    </swiper-item>
</swiper>
Page({
    data: {
        item: 0
    },
    changeItem(e) {
        console.log(e)
        this.setData({
            item:e.target.id
        })
    },
    changeTab(e) {
        this.setData({
            item: e.detail.current
        })
    }
})

第四题

 

 

 

 

<view class="container">
    <form>
        <view class="nn"> <text>姓名:</text> <input type="text" name="name" value="{{name}}" /> </view>
        <view class="ss"> <text>性别:</text>
            <radio-group name="gender"> <label wx:for="{{gender}}" wx:key="value">
                    <radio value="{{item.value}}" checked="{{item.checked}}"/>{{item.name}}
                </label> </radio-group>
        </view>
        <view class="zz"> <text>喜欢的运动:</text>
            <checkbox-group name="sports"> <label wx:for="{{sports}}" wx:key="*this">
                    <checkbox value="{{item.value}}" checked="{{item.checked}}"/>{{item.zm}}
                </label> </checkbox-group>
        </view>
    </form>
</view>

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值