vuejs / rfcs

RFCs for substantial changes / feature additions to Vue core
4.86k stars 548 forks source link

SFC easycom mode #237

Closed edison1105 closed 3 years ago

edison1105 commented 3 years ago

like https://uniapp.dcloud.io/collocation/pages?id=easycom

Traditional vue components need to be installed, referenced, and registered, and the components can be used after three steps. easycom reduced it to one step. As long as the components are installed in the components directory of the project and conform to the components/component name/component name.vue directory structure. You can use it directly on the page without import or registering. as follows:

<template>
    <view class="container">
        <uni-list>
            <uni-list-item title="one"></uni-list-item>
            <uni-list-item title="two"></uni-list-item>
        </uni-list>
    </view>
</template>
<script>
    // No need to import here, nor need to register in components
    export default {
        data() {
            return {

            }
        }
    }
</script>

No matter how many components are installed in the components directory, easycom will automatically remove unused components after packaging, which is particularly friendly to the use of component libraries.

Justineo commented 3 years ago

Please follow the RFC template. Thanks!