<template>
              <div>
                <Loading></Loading>
              </div>
            </template>

            <script type="text/babel">
              export default {
                data(){
                  return {
                        }
                },
                beforeMount() {
                  // 只会在浏览器执行  
                  this.$options.components.Loading = () =>import('vue-loading');
                },
                mounted(){
                }
              }
            </script>

使用beforeMount 函数去加载组件,这样组件在服务端就不会渲染,组件还可以配合v-if去控制组件的渲染

参考文章

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-27
  • 2022-12-23
  • 2022-01-14
猜你喜欢
  • 2021-09-05
  • 2022-12-23
  • 2021-10-20
  • 2021-09-06
  • 2021-09-10
相关资源
相似解决方案