emp icon indicating copy to clipboard operation
emp copied to clipboard

请问,有这么奇怪的问题吗?使用emp远程调用的组件会丢失部分标签。

Open bitem-cn opened this issue 3 years ago • 6 comments

image

bitem-cn avatar Jun 07 '22 01:06 bitem-cn

share 了吗

ckken avatar Jun 07 '22 03:06 ckken

@ckken demo-one port:7001

  const PluginBabelVue3 = require('@efox/plugin-babel-vue-3')
  const {defineConfig} = require('@efox/emp')
  module.exports=defineConfig(({mode,env})=>{  
      const port = 7001
      const target = "es5"  
      return {
          plugins: [PluginBabelVue3],
          appEntry: 'main.ts',
          server: {port: port},
          html: {title: 'EMP One'},
          build: {target},
          empShare: {
            name: 'one',
            exposes: {
              './GloryAbout': './src/views/OneAboutView.vue',
              './HelloWorld':'./src/components/HelloWorld.vue'
            },
            shareLib: {              
            },
          },
      }  
  })

demo-main port:7000

  const PluginBabelVue3 = require('@efox/plugin-babel-vue-3')
  const {defineConfig} = require('@efox/emp')
  module.exports=defineConfig(({mode,env})=>{  
      const port = 7000
      const target = "es5"  
      return {
          plugins: [PluginBabelVue3],
          appEntry: 'main.ts',
          server: {port: port},
          html: {title: 'EMP main'},
          build: {target},
          empShare: {
            name: 'main',
            remotes:{
              "@one":"one@http://localhost:7001/emp.js",
            },
            exposes: {       
            },
            shareLib: {              
            },
          },
      }  
  })

使用HomeView.vue

  <template>
    <div class="home">
      <h1>Home for Main App</h1>
      <img alt="Vue logo" src="../assets/logo.png">
      <HelloWorld msg="Welcome to Your Vue.js + TypeScript App from main"/>
    </div>
  </template>  
  <script lang="ts">
  import { Options, Vue } from 'vue-class-component';
  // import HelloWorld from '../components/HelloWorld.vue'; // @ is an alias to /src
  // @ts-ignore
  import HelloWorld from '@one/HelloWorld';  
  // import HelloWorld from '@one/GloryAbout'
  @Options({
    components: {
      HelloWorld
    },
  })
  export default class HomeView extends Vue {}
  </script>

补充:他不是整个组件不显示,组件显示了,只是组件中少了一部分标签。另外我只需要将导出的组件中div的数量删除一部分,只留两三个,就能正常显示 image

bitem-cn avatar Jun 07 '22 03:06 bitem-cn

把 vue share出来试试

ckken avatar Jun 07 '22 04:06 ckken

我刚刚使用原生webpack模块联邦实验,也有同样的问题,只要是相同标签连续出现多次,就会出现丢失标签的情况。

bitem-cn avatar Jun 07 '22 05:06 bitem-cn

把 vue share出来试试

试过并没有效果,问题根源应该不是这个

bitem-cn avatar Jun 07 '22 05:06 bitem-cn

可以放在线code 出来看看

ckken avatar Jul 10 '22 09:07 ckken