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

fix(timeline): [time-line] fix console error about event click undefined #1297

Merged
merged 2 commits into from
Feb 2, 2024

Conversation

gweesin
Copy link
Contributor

@gweesin gweesin commented Jan 13, 2024

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

using the Timeline component will cause Vue@2.6.14 runtime error

Issue Number: #1197

What is the new behavior?

The Timeline component could work seamlessly on both Vue 2 and Vue 3.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

The main issue is that the contentClick function is referenced in the pc.vue template without being defined there.

Vue 3, however, addresses this by transforming the code to onClick: _cache[0] || (_cache[0] = (...args) => _ctx.contentClick && _ctx.contentClick(...args)), ensuring the runtime executes successfully. In this setup, if _ctx.contentClick is undefined, it simply runs an empty function once.

On the other hand, Vue 2 translates it to on: {"click": _vm.contentClick"}, so if _vm.contentClick is undefined, an error occurs.

@gweesin gweesin changed the title Fix timeline console error fix(timeline): fix console error about event click undefined Jan 14, 2024
@kagol kagol added the bug Something isn't working label Jan 16, 2024
@kagol kagol changed the title fix(timeline): fix console error about event click undefined fix(timeline): [timeline] fix console error about event click undefined Jan 16, 2024
@kagol kagol changed the title fix(timeline): [timeline] fix console error about event click undefined fix(timeline): [time-line] fix console error about event click undefined Jan 16, 2024
@kagol kagol merged commit 7f766a3 into opentiny:dev Feb 2, 2024
7 of 8 checks passed
fanbingbing16 pushed a commit to fanbingbing16/tiny-vue that referenced this pull request Feb 13, 2024
…ined` (opentiny#1297)

* style(timeline): fix eslint validation errors

* fix(timeline): fix console error about `event click undefined`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants