Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

229.Uni-App - 自定义组件 - 自定义组件创建及使用 #229

Open
webVueBlog opened this issue May 12, 2020 · 1 comment
Open

229.Uni-App - 自定义组件 - 自定义组件创建及使用 #229

webVueBlog opened this issue May 12, 2020 · 1 comment
Labels
web综合 web综合

Comments

@webVueBlog
Copy link
Member

No description provided.

@webVueBlog webVueBlog added the web综合 web综合 label May 12, 2020
@webVueBlog
Copy link
Member Author

1、新建 组件.vue 文件
2、组件文档结构
<template name="组件名称">
	<view>
	    ......
	</view>
</template>
<script>
export default {
	name: "组件名称",
	//属性
	props: {
		属性名称: {
			type: String,//属性类型
			value: "值"
		},
		......
	},
	//组件生命周期
	created:function(e){
	
	},
	methods: {
		函数名称:function(obj){
		
		},
	}
}
</script>
<style>
组件样式
</style>
1、引用组件
import 组件名称 from "../../components/组件名.vue";
2、注册组件
export default{
	components:{
		组件名称
	},
}
3、在试图模板中使用组件
<组件名称 组件属性="对应的值"></组件名称>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
web综合 web综合
Projects
None yet
Development

No branches or pull requests

1 participant