Giter Club home page Giter Club logo

Comments (3)

zh-rocco avatar zh-rocco commented on June 15, 2024

@HaoDaYiGuoFan

将组件注册到全局,就可以实现 JS / TS 组件互相调用;

数据传输的话也是可以的:

  1. 方式一:主项目中注册一个全局事件总线,在 JS 项目和 TS 项目里使用 this.bus.$emitthis.bus.$on 通信;
  2. 方式二:使用 vuex;

但是这种场景下是不是没必要拆分成独立的两个子项目呢

from preload-routes.

HaoDaYiGuoFan avatar HaoDaYiGuoFan commented on June 15, 2024

@HaoDaYiGuoFan

将组件注册到全局,就可以实现 JS / TS 组件互相调用;

数据传输的话也是可以的:

  1. 方式一:主项目中注册一个全局事件总线,在 JS 项目和 TS 项目里使用 this.bus.$emitthis.bus.$on 通信;
  2. 方式二:使用 vuex;

但是这种场景下是不是没必要拆分成独立的两个子项目呢

我们项目要求子项目可以独立运行,但是又可以实现这种相互交互的操作

from preload-routes.

Jerrodly avatar Jerrodly commented on June 15, 2024

@HaoDaYiGuoFan
将组件注册到全局,就可以实现 JS / TS 组件互相调用;
数据传输的话也是可以的:

  1. 方式一:主项目中注册一个全局事件总线,在 JS 项目和 TS 项目里使用 this.bus.$emitthis.bus.$on 通信;
  2. 方式二:使用 vuex;

但是这种场景下是不是没必要拆分成独立的两个子项目呢

我们项目要求子项目可以独立运行,但是又可以实现这种相互交互的操作
可以通过类似sso的方式,毕竟以后多个项目可能存在多个技术栈,多个子项目通信最好通过windows或者注册一个全局事件总线,参考:https://github.com/hubvue/Micro-FE

from preload-routes.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.