步骤:
1.下载colorui,将colorui文件导入项目根目录
2.main.js 引入cu-custom组件全局使用
import { createSSRApp } from 'vue'
export function createApp() {
const app = createSSRApp(App)
// vue3使用app.component 注册为全局组件
app.component('cu-custom',cuCustom)
return {
app
}
}
3.app.vue 获取系统信息,设置导航栏高度
<script lang="ts" setup>
import { getCurrentInstance } from 'vue'
onLaunch(() => {
//导航栏高度
uni.getSystemInfo({
success: function(e) {
// 获取 appContext 上下文
const {appContext} = getCurrentInstance()
console.log('StatusBar',a