xc111222
xc111222
  • 发布:2022-12-27 22:50
  • 更新:2022-12-28 14:50
  • 阅读:864

uniapp的vue3版本能用colorUI的自定义导航栏吗?

分类:uni-app

说是css库,按理应该能用自定义导航栏,但我根据插件的教程用,用不了,有什么差异吗?难道要切换回vue2?

APP.vue没办法引入VUE

2022-12-27 22:50 负责人:无 分享
已邀请:
2***@qq.com

2***@qq.com

可以用的吧,
main.js里面
import Vue from 'vue'
import App from './App'
import colorUI from 'colorui-uni-app'

Vue.use(colorUI)

xc111222

xc111222 (作者)

uni.getSystemInfo({
success: function(e) {
// #ifndef MP
Vue.prototype.StatusBar = e.statusBarHeight;
if (e.platform == 'android') {
Vue.prototype.CustomBar = e.statusBarHeight + 50;
} else {
Vue.prototype.CustomBar = e.statusBarHeight + 45;
};
// #endif

                // #ifdef MP-WEIXIN  
                Vue.prototype.StatusBar = e.statusBarHeight;  
                let custom = wx.getMenuButtonBoundingClientRect();  
                Vue.prototype.Custom = custom;  
                Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;  
                // #endif         

                // #ifdef MP-ALIPAY  
                Vue.prototype.StatusBar = e.statusBarHeight;  
                Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;  
                // #endif  
            }  
        })
xc111222

xc111222 (作者)

在vue.app没办法用这个,是不支持吗?

  • 2***@qq.com

    报什么错?

    2022-12-28 11:49

  • 2***@qq.com

    vue.app 是一个用于构建原生应用的框架,是和 uni-app 没有任何关系的。所以,在 vue.app 中是无法使用 uni-app 的 API 的。

    2022-12-28 11:53

xc111222

xc111222 (作者)

识别不了import Vue from 'vue'

xc111222

xc111222 (作者)

Browserslist: caniuse-lite is outdated. Please run:
14:47:19.484 npx browserslist@latest --update-db
14:47:19.487 Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
14:47:21.700 Error when using sourcemap for reporting an error: Can't resolve original location of error.
14:47:21.701 'default' is not exported by node_modules\@dcloudio\uni-mp-vue\dist\vue.runtime.esm.js, imported by ..........\ideaWorkData\uniapp_wyoa_sjsjfx\App.vue
14:47:21.705 at App.vue:4:7
14:47:21.706 2:
14:47:21.709 3:
14:47:21.711 4: import Vue from 'vue'
14:47:21.714 ^
14:47:21.714 5: const _sfc_main = {
14:47:21.719 6: onLaunch: function() {

xc111222

xc111222 (作者)

源码
<script>
import Vue from 'vue'
export default {
onLaunch: function() {
uni.getSystemInfo({
success: function(e) {
// #ifndef MP
Vue.prototype.StatusBar = e.statusBarHeight;
if (e.platform == 'android') {
Vue.prototype.CustomBar = e.statusBarHeight + 50;
} else {
Vue.prototype.CustomBar = e.statusBarHeight + 45;
};
// #endif

      // #ifdef MP-WEIXIN  
      Vue.prototype.StatusBar = e.statusBarHeight;  
      let custom = wx.getMenuButtonBoundingClientRect();  
      Vue.prototype.Custom = custom;  
      Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;  
      // #endif  

      // #ifdef MP-ALIPAY  
      Vue.prototype.StatusBar = e.statusBarHeight;  
      Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;  
      // #endif  
    }  
  })  

},  
    onShow: function() {  
        console.log('App Show')  
    },  
    onHide: function() {  
        console.log('App Hide')  
    }  
}  

</script>

<style lang="scss">
@import "@/colorui/main.css";
@import "@/colorui/icon.css";
/每个页面公共css /
@import '@/uni_modules/uni-scss/index.scss';
/ #ifndef APP-NVUE /
@import '@/static/customicons.css';
// 设置整个项目的背景色
page {
background-color: #f5f5f5;
}

/* #endif */  
.example-info {  
    font-size: 14px;  
    color: #333;  
    padding: 10px;  
}  

</style>

  • 2***@qq.com

    你需要确保你的程序环境已经安装了 Vue.js,并且使用的是支持 import 语句的 JavaScript 解析器这些啊

    2022-12-29 01:09

  • xc111222 (作者)

    回复 2***@qq.com: 支持啊,我在HBuilderX里面的同一工程其他页面又可以用 import Vue from 'vue'

    2022-12-29 09:38

该问题目前已经被锁定, 无法添加新回复