A
A
Artur Galyaev2020-09-12 20:03:44
Vue.js
Artur Galyaev, 2020-09-12 20:03:44

How to wrap a component in Vue?

How to wrap one component in another? React example:

var Wrapper = React.createClass({
  render: function() {
    return (
      <div className="wrapper">
        before
          {this.props.children}
        after
      </div>
    );
  }
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bqio, 2020-09-12
@art5455

https://en.vuejs.org/v2/guide/components-slots.html

<component>
  <component2></component2>
</component>

Component template:
<component>
  <slot></slot>
</component>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question