App.vue 1.4 KB
Newer Older
DCloud_JSON's avatar
DCloud_JSON 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
<script>
  //1. 导入uni身份信息管理模块
  import uniIdPagesInit from '@/uni_modules/uni-id-pages/init.js';
  //2. 导入uniIm
  import uniIm from '@/uni_modules/uni-im/sdk/index.js';
  // 3.引入扩展插件(项目默认引入了,扩展插件uniImMsgReader用于展示消息是否已读)
  import MsgReaderExtension from '@/uni_modules/uni-im-msg-reader/extension.js'
  export default {
    onLaunch: async function() {
      console.log('App Launch');
      //4. 安装uniIm扩展插件
      MsgReaderExtension.install()
      //5. 初始化uni身份信息管理模块
      uniIdPagesInit();
      //6. 初始化uniIm
      uniIm.init();
    },
    onShow: function() {
      console.log('App Show');
    },
    onHide: function() {
      console.log('App Hide');
    }
  };
</script>

<style lang="scss">
  /*每个页面公共css */

  /* #ifdef H5 */
  @media screen and (min-width:960px) {

    /* pc宽屏 隐藏会话页面头部 && 全局底部导航 以下兼容了Vue2和3两种模式的样式*/
    uni-page[data-page="uni_modules/uni-im/pages/index/index"] uni-page-head,
    .uni_modules-uni-im-pages-index-index uni-page-head,
    uni-tabbar,
    .uni-app--showtabbar uni-page-wrapper::after {
      display: none !important;
    }
  }

  /* #endif */

  /* #ifndef APP-NVUE */
  @import "@/uni_modules/uni-im/static/iconfont.css";
  /* #endif */
</style>