收藏
回答

小白问一下为什么输入框输入数据报错?

输入框输入数据报错TypeError: Cannot read property 'value' of undefined

Page({
  data: {
    course:'',
    teacher:'',
    address:'',
    sksj:'',
    skjc:'',
    array1:['周一','周二','周三','周四','周五'],
    array2:['1-2''3-4''5-6''7-8'],
    index:0
  },
oncourseInput:function(event){
this.setData({
  course:event.detil.value,
});
},
onteacherInput:function(event){
  this.setData({
    techer:event.detil.value
  })
  },
  onaddressInput:function(event){
    this.setData({
      address:event.detil.value
    })
    },
    bindsksjPickerChange: function(e) {
      this.setData({
        sksj:e.detail.value
      })
    },
    bindskjcPickerChange: function(e) {
      this.setData({
        skjc:e.detail.value
      })
    }
})

<view class="page-body">
      <view class="page-section">
            <view class="weui-cells__title">
                  课程名称
            </view>
                  <view class="weui-cells weui-cells_after-title">
                        <view class="weui-cell weui-cell_input">
                              <input class="weui-input" value="{{course}}" auto-focus placeholder="请输入课程名称" bind:input="oncourseInput"/>
                        </view>
                  </view>
            </view>
      </view>


<view class="page-body">
      <view class="page-section">
            <view class="weui-cells__title">
                  授课老师
            </view>
                  <view class="weui-cells weui-cells_after-title">
                        <view class="weui-cell weui-cell_input">
                              <input class="weui-input" value="{{teacher}}" auto-focus placeholder="请输入老师姓名" bind:input="onteacherInput"/>
                        </view>
                  </view>
            </view>
</view>


<view class="page-body">
      <view class="page-section">
            <view class="weui-cells__title">
                  上课教室
            </view>
                  <view class="weui-cells weui-cells_after-title">
                        <view class="weui-cell weui-cell_input">
                              <input class="weui-input" value="{{address}}" auto-focus placeholder="请输入教室地址" bind:input="onaddressInput"/>
                        </view>
                  </view>
      </view>
</view>


<view class="page-body">
      <view class="weui-cells__title">
            上课时间
      </view>
      <picker bindchange="bindsksjPickerChange" value="{{sksj}}" range="{{array1}}">
            <view class="weui-pick">
             当前选择:{{array1[index]}}
           </view>
      </picker>
</view>
<view class="page-body">
      <view class="weui-cells__title">
            上课节次
      </view>
      <picker bindchange="bindskjcPickerChange" value="{{skjc}}" range="{{array2}}">
            <view class="weui-pick">
             当前选择:{{array2[index]}}
           </view>
      </picker>
</view>


<button>点击添加课程</button>
回答关注问题邀请回答
收藏

1 个回答

  • Mr.Zhao
    Mr.Zhao
    01-10

    错别字大佬,detail 和 detil

    01-10
    有用 1
    回复 2
    • 丶Pumpkin
      丶Pumpkin
      01-11
      .....好的谢谢大佬,我是笨b
      01-11
      回复
    • Memory
      Memory
      发表于移动端
      01-11回复丶Pumpkin
      不。你只是马大哈
      01-11
      回复
登录 后发表内容
问题标签