#
zhou zhou
7 天以前 bccdb8f81c07c8a9cdcd6838173dfd1c73c98d90
main.js
@@ -18,6 +18,19 @@
import uView from '@/uni_modules/uview-ui'
Vue.use(uView)
Vue.mixin({
   methods: {
      $showToast(options) {
         if (this.$refs.uToast) {
            this.$refs.uToast.show(options);
         } else {
            // Fallback if component not found or loaded yet
            uni.$u.toast(typeof options === 'string' ? options : (options.message || options.title));
         }
      }
   }
})
const i18n = new VueI18n(i18nConfig)
const app = new Vue({
   ...App,
@@ -38,6 +51,17 @@
export function createApp() {
   const app = createSSRApp(App)
   app.use(uView)
   app.mixin({
      methods: {
         $showToast(options) {
            if (this.$refs.uToast) {
               this.$refs.uToast.show(options);
            } else {
               uni.$u.toast(typeof options === 'string' ? options : (options.message || options.title));
            }
         }
      }
   })
   return {
      app
   }