@ray-js/components-ty-perf-text 组件报错

小程序开发相关产品技术讨论,包括面板、智能小程序、React Native、Ray跨端框架、Panel SDK、微信小程序、小程序开发工具(IDE)及其他开发技术相关等话题


Post Reply
silverlight
Posts: 95

  • Tuya MiniApp Tools 版本信息:Node: v18.17.0 Tools: 0.7.0 Ray: 1.5.20
    • App 应用版本信息: 设置-关于中进行查看~
    • @ray-js/ray, @ray-js/panel-sdk的版本: "@ray-js/panel-sdk": "1.10.0","@ray-js/ray": "1.5.20",
      "@ray-js/components-ty-perf-text": "0.0.6",
      "@ray-js/components-ty-slider": "0.2.46",
    • 问题描述(复现步骤):使用组件有这个错误信息

      Code: Select all

      service.js?side=service:3 [Component] property "textStyle" of "_npm/@ray-js/components-ty-perf-text/lib/perf-text/index" received type-uncompatible value: expected <Object> but got null-typed value. Used null instead.
      报错说明PerfText 组件中 textStyle 属性期望接收一个对象类型的值,但实际接收到的是 null 类型的值
      但接口中不存在该属性,而组件存在该属性
      这是接口中的属性

      Code: Select all

      import React from 'react';
      export interface IProps {
          /**
           * @description.en instanceId
           * @description.zh instanceId
           * @default null
           */
          instanceId?: string;
          /**
           * @description.en event channel eventName
           * @description.zh event channel 事件名
           * @default null
           */
          eventName: string;
          /**
           * @description.en valueStart
           * @description.zh valueStart
           * @default 0
           */
          valueStart?: number;
          /**
           * @description.en valueScale
           * @description.zh valueScale
           * @default 1
           */
          valueScale?: number;
          /**
           * @description.en defaultValue
           * @description.zh 默认值
           * @default ''
           */
          defaultValue?: string | number;
          /**
           * @description.en style
           * @description.zh 样式
           * @default null
           */
          style?: React.CSSProperties;
          className?: string;
      }
      export declare const defaultProps: IProps;
      
      组件中的属性

      Code: Select all

      Component({
        properties: {
          instanceId: String,
          eventName: String,
          className: String,
          valueStart: {
            type: Number,
            value: 0
          },
          valueScale: {
            type: Number,
            value: 1
          },
          defaultValue: {
            type: String,
            value: ''
          },
          textStyle: {
            type: Object
          }
        }
      });
      
Last edited by silverlight on 2024年 Aug 19日 18:14, edited 2 times in total.

Tags:
muhai
Posts: 63

Re: @ray-js/components-ty-perf-text 组件报错

yarn add --registry=https://registry.npmjs.org/ @ray-js/components-ty-perf-text@0.0.7

安装这个版本试试

silverlight
Posts: 95

Re: @ray-js/components-ty-perf-text 组件报错

muhai 2024年 Aug 16日 10:59

yarn add --registry=https://registry.npmjs.org/ @ray-js/components-ty-perf-text@0.0.7

安装这个版本试试

卸载重装后还是报错,现在提示变成了收到的是字符串类型,虽然这个报错暂时不影响正常使用这个组件。但想知道这个报错出现的textstyle是否就接口属性中的style?

Code: Select all

service.js?side=service:3 [Component] property "textStyle" of "_npm/@ray-js/components-ty-perf-text/lib/perf-text/index" received type-uncompatible value: expected <Object> but got string-typed value. Used null instead.
muhai
Posts: 63

Re: @ray-js/components-ty-perf-text 组件报错

yarn add --registry=https://registry.npmjs.org/ @ray-js/components-ty-perf-text@0.0.8

试试这个版本。类型警告暂时不影响的。

silverlight
Posts: 95

Re: @ray-js/components-ty-perf-text 组件报错

muhai 2024年 Aug 19日 18:08

yarn add --registry=https://registry.npmjs.org/ @ray-js/components-ty-perf-text@0.0.8

试试这个版本。类型警告暂时不影响的。

谢谢,已经成功修复了。因为在做slider组件相关的测试,所以想尽可能减少出问题的地方。

Post Reply