Tencent / tdesign-miniprogram

A Wechat MiniProgram UI components lib for TDesign.
https://tdesign.tencent.com/miniprogram
MIT License
1.21k stars 277 forks source link

[t-stepper] change事件 打印e报错 #3241

Closed herohql521 closed 57 minutes ago

herohql521 commented 2 hours ago

tdesign-miniprogram 版本

1.4.2

重现链接

No response

重现步骤

     <t-stepper defaultValue="0" disable-input theme="filled" data-id="{{item.id}}" bind:change="numChange"/>

    numChange(e){
      console.log(e)
      const id = e.currentTarget.dataset.id
      console.log(id)
    }

页面加载被阻断,加载异常,控制台报错 TypeError: Cannot read property 'createInstance' of null at Function.w._advancedCreate (WASubContext.js?t=wechat&s=1730185288000&v=3.5.3:1) at c.createComponent (WASubContext.js?t=wechat&s=1730185288000&v=3.5.3:1) at _o (WASubContext.js?t=wechat&s=1730185288000&v=3.5.3:1) at ho (WASubContext.js?t=wechat&s=1730185288000&v=3.5.3:1) at ho (WASubContext.js?t=wechat&s=1730185288000&v=3.5.3:1) at WASubContext.js?t=wechat&s=1730185288000&v=3.5.3:1 at xo (WASubContext.js?t=wechat&s=1730185288000&v=3.5.3:1) at wo (WASubContext.js?t=wechat&s=1730185288000&v=3.5.3:1) at xo (WASubContext.js?t=wechat&s=1730185288000&v=3.5.3:1) at wo (WASubContext.js?t=wechat&s=1730185288000&v=3.5.3:1)(env: Windows,mp,1.06.2402040; lib: 3.5.3)

期望结果

期望change回调能正常使用e返回的数值及currentTarget上的属性

实际结果

No response

基础库版本

No response

补充说明

No response

github-actions[bot] commented 2 hours ago

👋 @herohql521,感谢给 TDesign 提出了 issue。 请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

herohql521 commented 2 hours ago

有的时候好使,一刷新就坏,大部分时候是不好使的,和回调也没有关系,去掉change事件问题依旧

herohql521 commented 2 hours ago

页面中放一个最基本的步进器也会报错,不知道是哪里影像的? ["./miniprogram_npm/tdesign-miniprogram/stepper/stepper.wxml:view:3:2"] {currentValue: 0, classPrefix: "t-stepper", prefix: "t", disableInput: false, disabled: false, …} VM21014:80 TypeError: Cannot read property '0' of undefined at e (wxml.js?t=wechat&s=1730185288000&v=87f0058c6c91fa2242c293137da1d497:1) at h (wxml.js?t=wechat&s=1730185288000&v=87f0058c6c91fa2242c293137da1d497:1) at M (wxml.js?t=wechat&s=1730185288000&v=87f0058c6c91fa2242c293137da1d497:1) at m0 (:48:9) at :76:1 at po (WASubContext.js?t=wechat&s=1730185288000&v=3.5.3:1) at t.jo.create (WASubContext.js?t=wechat&s=1730185288000&v=3.5.3:1) at Function.w.prepare (WASubContext.js?t=wechat&s=1730185288000&v=3.5.3:1) at Function.w._advancedCreate (WASubContext.js?t=wechat&s=1730185288000&v=3.5.3:1) at c.createComponent (WASubContext.js?t=wechat&s=1730185288000&v=3.5.3:1)

anlyyao commented 2 hours ago

贴一下完整的实际代码

herohql521 commented 1 hour ago

贴一下完整的实际代码

<view class="con">
  <view class="search_box flex justify-between">
    <t-search placeholder="请输入您需要的耗材" value="{{searchValue}}" bind:change="saerchChange" />
  </view>
  <view class="list">
    <view class="card" wx:for="{{listData}}" wx:key="index">
      <view class="item">
        <view class="header flex justify-start items-center">
          <text class="shu"></text>
          <view class="name">{{item.cmName}}</view>
          <view class="status" style="margin-left:auto;">{{item.storeStateName}}</view>
        </view>
        <view class="content flex justify-start items-start">
          <image class="image" src="{{item.pcImagePath}}"></image>
          <view>
            <view class="item-detail">
              <text class="icon icon-a-xinghao_huaban1"></text> 型号:{{item.cmModel}}
            </view>
            <view class="item-detail">
              <text class="icon icon-a-jiliangdanwei_huaban1"></text>计量单位:{{item.cmUnit}}
            </view>
            <view class="item-detail">
              <text class="icon icon-a-cunfangdian_huaban1"></text>存放点:{{item.labName}}
            </view>
          </view>
        </view>
        <view class="content">
          <view class="flex justify-between mb-20">
            <view class="flex-1">
              <text class="icon icon-a-fuzeren_huaban1"></text>负责人:{{item.createBy}}
            </view>
            <view class="flex-1">
              <text class="icon icon-a-zerenbumen_huaban1"></text>责任部门:{{item.deptName}}
            </view>
          </view>
          <view  class="flex justify-between">
            <view class="flex-1">
              <text class="icon icon-a-kucunshuliang_huaban1"></text>库存数量:<text style="color:#46a0ac">{{item.createBy}}</text>
            </view>
            <!-- <t-stepper  defaultValue="1" disable-input theme="filled" data-id="{{item.id}}" bind:change="numChange"/> -->
            <t-stepper defaultValue="3" theme="filled" />

          </view>

        </view>

      </view>
    </view>
  </view>
</view>
herohql521 commented 1 hour ago

贴一下完整的实际代码

// subPackageC/pages/consumables/consumables.js
import {
  getHcList,
} from '../../../api/index'
Page({

    /**
     * 页面的初始数据
     */
    data: {
      searchValue: '',
      listData: [],
    },  

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {

    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {
      this.getList()
    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom() {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {

    },
    saerchChange(e) {
      const {
        value
      } = e.detail;
      this.setData({
        searchValue: value
      });
      this.getList()
    },
    getList(){
      const params = {
        searchValue: this.data.searchValue,
        cmType:1,

      }
      getHcList(params).then(res=>{
        const listData = res.data.rows
        this.setData({
          listData
        })
      })
    },
    numChange(e){
      console.log(e)
      const id = e.currentTarget.dataset.id
      console.log(id)
    }
})
herohql521 commented 1 hour ago

贴一下完整的实际代码

没事了,是开发者工具的bug!!!! 重启正常了!!!

anlyyao commented 57 minutes ago

👌 那我这边就先关闭issue啦,有问题可以在重新开帖讨论~