V
V
Vladimir Golub2019-10-17 21:57:00
Vue.js
Vladimir Golub, 2019-10-17 21:57:00

How to wire functional components inside a functional component?

Here is the code for the
Main Component:

<template functional>
    <div class="tariff-item">
        <div class="tariff-item__top">
            <h3 class="tariff-item__title"></h3>
            <ul class="tariff-item__list">
                <li
                    class="tariff-item__item"
                    v-for="item in items"
                >
                </li>
            </ul>
        </div>
        <div class="tariff-item__bottom">
            <p class="tariff-item__price">{{ price }}</p>
            <p class="tariff-item__time">{{ time }}</p>
            <Button
                :title="Кнопка"
            />
        </div>
    </div>
</template>

<script>
    import Button from '../elements/Button';

    export default {
        functional: true,
        name: "TariffItem",
        components: {
            Button
        }
    }
</script>

Button Component:
<template functional>
    <button
        class="button"
        @click="clickFunc"
    >
            { title }
    </button>
</template>

<script>
    export default {
        functional: true,
        name: "Button",
        props: {
            'title': {
                type: String,
                default: ''
            },
            'clickFunc': {
                type: Function,
                default: () => {}
            }
        },
    }
</script>

How to properly connect them together?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
its2easyy, 2019-10-17
@RazerVG

They don't work by default, but there are crutches https://github.com/vuejs/vue/issues/7492

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question