1 components文件下的vue文件
<template name="page-head">
<view class="uni-page-head">
<view class="uni-page-head-title">{{title}}</view>
</view>
</template>
<script>
export default {
name: "page-head",
props: {
title: {
type: String,
default: ""
}
}
}
</script>
2 main.js
import pageHead from './components/page-head.vue'
Vue.component('page-head',pageHead)
如果要引用多个,即分别插入即可
import pageLog from "./components/template/log";
Vue.component("page-log", pageLog);
import pageLoad from "./components/template/loadmore";
Vue.component("page-load", pageLoad);
import uniNavBar from "./components/uni-nav-bar/uni-nav-bar";
Vue.component("uni-nav-bar", uniNavBar);
3 需要引用的文件下
<page-head :title="title"></page-head>