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

$attrs is undefined #1586

Closed
mirhat opened this issue Sep 4, 2017 · 9 comments
Closed

$attrs is undefined #1586

mirhat opened this issue Sep 4, 2017 · 9 comments
Assignees
Labels
T: bug Functionality that does not work as intended/expected

Comments

@mirhat
Copy link
Contributor

mirhat commented Sep 4, 2017

Steps to reproduce

Create v-text-field

Versions

vue 2.8.2
vuetify 0.15.0-beta.5

What is expected ?

There should be input field

What is actually happening ?

Input field is not showing and I am getting error

TypeError: Cannot read property 'id' of undefined
at VueComponent.genLabel (vuetify.js:829)
at VueComponent.boundFn [as genLabel]

Here is genLabel function:

genLabel: function genLabel() {
      return this.$createElement('label', {
        attrs: {
          for: this.$attrs.id
        }
      }, this.$slots.label || this.label);
    },

Reproduction Link

https://jsfiddle.net/9jht1sbk/1/

@johnleider johnleider added the T: bug Functionality that does not work as intended/expected label Sep 4, 2017
@johnleider johnleider self-assigned this Sep 4, 2017
@mirhat
Copy link
Contributor Author

mirhat commented Sep 4, 2017

Input field is showing if I there is no label property on v-text-field

@KaelWD
Copy link
Member

KaelWD commented Sep 4, 2017

vue 2.8.2

  1. Are you from the future?
  2. That fiddle is using 2.2.1, it works fine with 2.4.2: https://jsfiddle.net/er3m4emt/

@johnleider
Copy link
Member

This issue should have been resolved from the latest release. I am unable to reproduce it with the given information as @KaelWD pointed out, you must be on vue@2.4 branch.

If this is incorrect and you are still able to reproduce it, please provide additional reproduction steps, otherwise I'll considered this closed.

@mirhat
Copy link
Contributor Author

mirhat commented Sep 4, 2017

It is my mistake, I had wrong version of vue. It is working now.
Thank you!

@bradstewart
Copy link

There's still an issue here. I believe it's related to vuejs/vue#6263, not Vuetify specifically, but in case someone else comes looking...

I'm seeing this error when using render functions and supplying a label prop with vue@2.4.2 and vuetify@0.15.3:

//...
return h('v-text-field', {
  props: {
    label: meta.label,
    hint: meta.hint,
    required: meta.required,
    value: this.model[meta.field],
  },
  on: {
    input: (value) => {
      this.model[meta.field] = value
    },
  },
})
//...

Removing the label key from the props object resolves it. I'll extract it into a fiddle later today, if I find a spare minute.

@johnleider
Copy link
Member

Is it reproduce-able in a codepen?

@bradstewart
Copy link

bradstewart commented Sep 11, 2017

I have some work to knock out right now, but I'll attempt to reproduce it in a fiddle/codepen later today.

@johnleider https://jsfiddle.net/er3m4emt/4/

@jay-zahiri
Copy link

+1

@lock
Copy link

lock bot commented Apr 15, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please direct any non-bug questions to our Discord

@lock lock bot locked as resolved and limited conversation to collaborators Apr 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

No branches or pull requests

5 participants