uni-app 组件定义使用及父子组件传值

组件定义使用

在项目的/component目录下存放组件,在要显示组件的页面中则分为3步:导入、注册和使用。

<template>
	<view class="phone">
		//  
		<uni-coms ></uni-coms>  //第三步:使用组件(这里单标签双标签都可以)
	</view>
</template>

<script>
import uniComs from "@/components/uni-coms/uni-coms.vue" //第一步:导入组件
export default {
	components: {
		uniComs  //第二部:注册组件
	}
}
</script>

注意:
uni-app只支持vue单文件组件(.vue 组件)。其他的诸如:动态组件,自定义 render,和

你可能感兴趣的:(uni-app)