Giter VIP home page Giter VIP logo

Comments (5)

ErikMinekus avatar ErikMinekus commented on September 27, 2024

The issue is caused by the List component, see c24f7c8. It used to have these lines in mounted():

if (this.$parent.$options._componentTag !== 'm-menu') {
  this.mdcList = MDCList.attachTo(this.$el)

This line was deleted, so now you have to set the js prop to false to ensure it doesn't instantiate the MDCList component. Except this causes a JavaScript error here:

onAction (e) {
  this.$emit('change', this.mdcList.selectedIndex)

since this.mdcList is not instantiated.

from material-components-vue.

matsp avatar matsp commented on September 27, 2024

@ErikMinekus Thanks for finding the issue! Feel free to submit a PR πŸ‘

from material-components-vue.

tychenjiajun avatar tychenjiajun commented on September 27, 2024

@ErikMinekus So sorry that I made a mistake in previous versions. JavaScript component is optional in some components like List in mdc-web. That's why js is introduced. And some components like Menu, Drawer and Tab Bar can instantiate their children component, which may cause duplicate instantiation. I've fixed this issue in Tab Bar in #443 and discuss some solutions in #113. But there's still lots of work to do on the other components including Menus. Excuse for any mistakes in my explanations and feel free to help or submit a PR.

from material-components-vue.

ErikMinekus avatar ErikMinekus commented on September 27, 2024

@tychenjiajun I'm relatively new to Vue and Material components, but I think for Menu it would be best to just hardcode <ul class="mdc-list"> in the Menu component, like in the enhanced Select. This would be a breaking change, but at least people can't forget to set js to false.

I'm not familiar with how Drawer and TabBar can instantiate child components, so I can't comment on that. But it should be documented when you have to set js to false.

from material-components-vue.

tychenjiajun avatar tychenjiajun commented on September 27, 2024

@ErikMinekus In the enhanced Select, List is hardcoded to make enhanced reactive. So I think it's better to keep it hardcoded in mdc-web version 3.x.x. Since 4.0.0, the basic Select is deprecated and only enhanced Select is kept. So our enhanced will be deprecated too. I thinks it's ok to introduce more breaking change when updating to mdc-web 4.0.0 so Select will be changed to the same style as what Menu is now.

Whatever, thank you for this issue and PR!

from material-components-vue.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.