-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
can`t get this in props default function #1886
Comments
t get
this` in props default function
With the commit above you should be able to do contentHtml: {
type: String,
default (props) {
console.log(props.theme)
},
} I think it's best to prohibit |
nice I see this problem still cant work in your way the current version 3.0.0-rc.5 |
@yyx990803 In Vue 2, accessing In particular, the documentation includes the following example for const Child = {
inject: ['foo'],
props: {
bar: {
default () {
return this.foo
}
}
}
} I don't know how often this was used. Here's an example I found in the Vuetify codebase that passes global configuration to a |
rc.7 is OK. |
Use inject to set props default value was possibile. did you have any solution now ? @skirtles-code |
@xxholly32 Not directly. You could use a computed property to apply a default instead. |
Version
3.0.0-rc.5
Reproduction link
https://jsfiddle.net/xxholly32/w7k8vzng/19/
Steps to reproduce
https://jsfiddle.net/xxholly32/w7k8vzng/19/
i have two related props
theme
andcontentHtml
, but i cant get information from default function.What is expected?
like vue2 , i can get theme value in default function
What is actually happening?
console will be 'undefined'
i think props default function should have attr like
setup
, or this should be work againThe text was updated successfully, but these errors were encountered: