Ver código fonte

首次提交

ZaiZai 9 meses atrás
pai
commit
09d25d6c73
4 arquivos alterados com 19 adições e 33 exclusões
  1. 2 2
      App.vue
  2. 0 13
      js_sdk/uni.promisify.adaptor.js
  3. 13 17
      main.js
  4. 4 1
      style/app.scss

+ 2 - 2
App.vue

@@ -12,6 +12,6 @@
 	}
 </script>
 
-<style>
-	/*每个页面公共css */
+<style lang="scss">
+@import "@/style/app.scss";
 </style>

+ 0 - 13
js_sdk/uni.promisify.adaptor.js

@@ -1,13 +0,0 @@
-uni.addInterceptor({
-    returnValue(res) {
-        if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) {
-            return res;
-        }
-        return new Promise((resolve, reject) => {
-            res.then((res) => {
-                if (!res) return resolve(res)
-                return res[0] ? reject(res[0]) : resolve(res[1])
-            });
-        });
-    },
-});

+ 13 - 17
main.js

@@ -1,22 +1,18 @@
 import App from './App'
+import { createSSRApp } from 'vue'
+import setupPinia from './store/init'
 
-// #ifndef VUE3
-import Vue from 'vue'
-import './uni.promisify.adaptor'
-Vue.config.productionTip = false
-App.mpType = 'app'
-const app = new Vue({
-  ...App
-})
-app.$mount()
-// #endif
+import 'uno.css'
+
+//挂载全局
+import {setupComponents} from './components/index'
 
-// #ifdef VUE3
-import { createSSRApp } from 'vue'
 export function createApp() {
-  const app = createSSRApp(App)
-  return {
-    app
-  }
+    const app = createSSRApp(App)
+    // 挂载状态管理
+    app.use(setupPinia)
+    // 组件注册全局
+    setupComponents(app);
+
+    return {app}
 }
-// #endif

+ 4 - 1
style/app.scss

@@ -3,7 +3,10 @@
     padding: 0;
     box-sizing: border-box;
 }
-
+page {
+    background: #EFEFF4;
+}
 text {
     display: inline-block;
 }
+