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

Forced to use props={{}} #48

Open
pksorensen opened this issue Nov 11, 2019 · 7 comments
Open

Forced to use props={{}} #48

pksorensen opened this issue Nov 11, 2019 · 7 comments

Comments

@pksorensen
Copy link

I am running into a problem that I dont think is how it used to work, but not sure.

Given my component.

import Vue, { VNode } from 'vue';
import * as tsx from "vue-tsx-support";
import { Component, Prop, Watch } from 'vue-property-decorator';
 
export interface SiHomeSectionTags {
    title: string;
}
 
@Component
export default class SiHomeSection extends tsx.Component<SiHomeSectionTags>{

    @Prop()
    title!: string;
   
    render() {

        return [
            <header class="fxs-home-title" aria-label={this.title}>{this.title}</header>,
            <div class="fxs-home-section">
                {this.$slots.default}
            </div>
        ];
    }
         
}

i cant use title as an attribute, but have to use props= - is that intended?

image

@mesqueeb
Copy link

mesqueeb commented Jan 19, 2020

I have the same problem. I'm forced to use props and attrs respectively.

I am forced to write:

<MyComponent {...{props: myProps}} />

But I wish I could write (but this does not work):

<MyComponent {...myProps} />

@wonderful-panda
Copy link
Owner

image

image

Seems to be working.
Can you show me minimal reproducible example ?

@pksorensen
Copy link
Author

With the latest versions of stable, or dev, i do not get the experience you have above.

I will try to create a minimal repro with the issue.

@pksorensen
Copy link
Author

Just to show it.

image

image

image

@pksorensen
Copy link
Author

pksorensen commented Jan 26, 2020

Here is a repro: https://github.com/pksorensen/tsx-issue

just run npm install and npm run dev and you should see the build errors

@wonderful-panda

@wonderful-panda
Copy link
Owner

3.0.0-dev.* needs additional configuration.

Downgrade vue-tsx-support to 2.3.3, or add "jsxFactory": "VueTsxSupport" to your tsconfig.json (
see https://github.com/wonderful-panda/vue-tsx-support/tree/beta#installation)

I tested both way, and both worked as expected.

BTW, I don't recommend to use 3.0.0-dev.*, because there is a possibility of some breaking changes until release of 3.0.0.

@pksorensen
Copy link
Author

pksorensen commented Jan 27, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants