在项目根目录下,创建 components 文件夹,新建文件myinput.vue。
<template name="myinput">
<view>
<input class="myinput" type="text" placeholder="请输入信息" value="" />
</view>
</template>
<script>
export default {
name: 'myinput',
props: {
},
data() {
return {
}
},
methods: {
}
}
</script>
<style>
.myinput{padding: 20upx;background: #f4f5f6;}
</style>
在index.vue中引用:
<myinput></myinput>
<script>
import myinput from '../../components/myinput.vue'
export default {
components:{
myinput
},
}
</script>
网友评论