Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[notice-bar] visible 使用变量控制为false时控制台报错 #2176

Open
zavatar opened this issue Jul 11, 2023 · 5 comments
Open

[notice-bar] visible 使用变量控制为false时控制台报错 #2176

zavatar opened this issue Jul 11, 2023 · 5 comments
Labels
question This is a question, not a bug

Comments

@zavatar
Copy link

zavatar commented Jul 11, 2023

tdesign-miniprogram 版本

1.1.10

重现链接

No response

重现步骤

.js 文件:

Page({
  data: {
    noticeVisible: false,
    logs: []
  }
})

.wxml 文件:
<t-notice-bar visible="{{noticeVisible}}" content="这是一条普通的通知信息"></t-notice-bar>

期望结果

No response

实际结果

image

基础库版本

2.33.0

补充说明

No response

@github-actions
Copy link
Contributor

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

@LeeJim
Copy link
Collaborator

LeeJim commented Jul 11, 2023

试了下,并不会报错,麻烦确认下是不是这个组件的问题

@LeeJim LeeJim added the question This is a question, not a bug label Jul 11, 2023
@zavatar
Copy link
Author

zavatar commented Jul 12, 2023

试了下,并不会报错,麻烦确认下是不是这个组件的问题

试试这个片段能复现么:https://developers.weixin.qq.com/s/6ZXexDmd7eJs ,只有false时会报错,报错堆栈最后指向notice-bar.js。基础库版本需要新一些,比较旧的不会报错。

@LeeJim
Copy link
Collaborator

LeeJim commented Jul 12, 2023

我换了 2.33.0 基础库就开始出现问题了。我研究下

@unrealsmart
Copy link

我这里报错是因为content属性

错误:

Page({
  data: {
    noticeContent: ['abc'],
  },
})
<t-notice-bar
...
content="{{noticeContent}}"
...
></t-notice-bar>

正确:

<t-notice-bar
...
content=""
...
></t-notice-bar>

<t-notice-bar
...
content="通知内容abc"
...
></t-notice-bar>

// a.js
Page({
...
  data: {
    searchValue: '',
    noticeContent: [],
  },
...
})
// a.wxml
<t-notice-bar
...
content="{{noticeContent}}"
...
></t-notice-bar>


不加content属性时,但谁会不填写通知内容?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This is a question, not a bug
Projects
None yet
Development

No branches or pull requests

3 participants