uni中组件的创建
在uni-app中,可以通过创建一个后缀名为vue的文件,就是创建组件成功,其他组件可以将该组件通过import的方式导入,在components进行注册
1.创建组件,在component目录创建test目录,然后新建test.vue文件:
<template>
<view>这是test组件</view>
</template>
<script>
</script>
<style>
</style>
2.在其他组件导入该组件并注册
import login from "@/components/test/test.vue"
3.注册组件
components:{
test}
4.在页面直接使用标签
<template>
<view>
<test></test