微前端为什么舍弃了 iframe

如果不考虑体验问题,iframe 是最完美的微前端解决方案。 但着产品体验的需求增强,iframe 又带来了一些不好的体验。 url 不同步。浏览器刷新 iframe url 状态丢失、后退前进按钮无法使用。 UI 不同步,DOM 结构不共享。想象一下屏幕右下角 1/4 的 iframe 里来一个带遮罩层的弹框,同时我们要求这个弹框要浏览器居中显示,还要浏览器 resize 时自动居中.. 全局上下文完全隔离,内存变量不共享。iframe 内外系统的通信、数据同步等需求,主应用的 cookie 要透传到根域名都不同的子应用中实现免登效果。 慢。每次子应用进入都是一次浏览器上下文重建、资源重新加 …

Vue 3 引入 Fullcalendar

Vue 3 引入 Fullcalendar JS版 <template> <div class=”card” ref=”cal”></div> </template> <script> import { ref,defineComponent, onMounted} from ‘vue’; import {Calendar} from ‘@fullcalendar/core’ import dayGridPlugin from ‘@fullcalendar/daygrid’; import timeGridPlugin from ‘@ …

vue 3 获取DOM

Vue 2获取DOM <div ref=“Ref”></div> this.$refs.Ref Vue 3获取单DOM <template>   <div ref=“Ref”>获取单个DOM元素</div> </template> <script> import { ref, onMounted } from ‘vue’; export default {   setup() {     const Ref = ref(null);     …

vue3 迁移 父子组件传值同步

代码中 .sync 的部替换为 v-model: <ChildComponent :title.sync=”pageTitle” /> <!– 替换为 –> <ChildComponent v-model:title=”pageTitle” /> 对于所有不带参数的 v-model,请确保分别将 prop 和 event 命名更改为 modelValue 和 update:modelValue <ChildComponent v-model=”pageTitle” /> // ChildComponent.vue export default …

vue3 vue2 keep-alive 差异

配置App.vue vue2.x与vue3.0的App.vue配置有差异,在App.vue配置信息如下: vue2.x中,router-view可整个放入keepalive中,如下: <template> <!– vue2.x配置 –> <keep-alive> <router-view v-if=”$route.meta.keepAlive” /> </keep-alive> <router-view v-if=”!$route.meta.keepAlive”/> </template> vue3.0的A …

vue3 迁移 listeners

# 概览 $listeners 对象在 Vue 3 中已被移除。现在事件监听器是 $attrs 的一部分: { text: ‘this is an attribute’, onClose: () => console.log(‘close Event triggered’) } # 2.x 语法 在 Vue 2 中,你可以使用 this.$attrs 和 this.$listeners 分别访问传递给组件的 attribute 和事件监听器。结合 inheritAttrs: false,开发者可以将这些 attribute 和监听器应用到其它元素,而不是根元素: <template …

vue js项目中引入ts混用

一、安装typescript及loader npm install typescript ts-loader –save-dev 二、安装vue-property-decorator npm install vue-property-decorator –save-dev 三、配置vue.config.js module.exports = {   configureWebpack: {     resolve: {       extensions: [“.ts”, “.tsx”, “.js”,  …