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

Create jsx-render #10997

Closed
wants to merge 4 commits into from
Closed

Create jsx-render #10997

wants to merge 4 commits into from

Conversation

@guohuihot
Copy link

guohuihot commented Jan 9, 2020

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:
Make Vue extends freer
Example

// a.vue
<template>
    <div>
        other code ...
        <!-- jsx code ... -->
        <jsx-render render-content="renderContent1" />
        <jsx-render render-content="renderContent1" />
        <jsx-render render-content="renderContent2" />
        other code ...
    </div>
</template>

<script>
export default {
    name: 'Custom',
    methods: {
        renderContent1() {
            // jsx code ...
            return <div>1</div>
        },
        renderContent2() {
            // jsx code ...
            return <div>2</div>
        },
        renderContent3() {
            // jsx code ...
            return <div>3</div>
        }
    }
}
</script>
// b.vue
<script>
export default {
    name: 'Custom1',
    extends: b,
    methods: {
        renderContent1() {
            // jsx code ...
            return <div>1111</div>
        },
        renderContent2() {
            // jsx code ...
            return <div>2222</div>
        },
        renderContent3() {
            // jsx code ...
            return <div>3333</div>
        }
    }
}
</script>
guohuihot added 4 commits Jan 9, 2020
component jsx render
Create jsx-render
@dizzpite

This comment has been minimized.

Copy link

dizzpite commented Jan 10, 2020

For your cases u can use v-html
And this is plain component, u can use render with
https://github.com/vuejs/babel-plugin-transform-vue-jsx
if understand correctly

@posva

This comment has been minimized.

Copy link
Member

posva commented Jan 10, 2020

Thanks for the PR but there is no need to add this component to vue core, it's better as an external utility

@posva posva closed this Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.