当前位置: 首页 > news >正文

做网站收录高端网站制作

做网站收录,高端网站制作,h5在线网站建设,我想看b站直播开元棋牌经过几个小时的努力&#xff0c;终于实现了&#xff0c;根据组件名异常加载组件&#xff0c;直接上代码&#xff0c;网上的很多代码方都有坑&#xff0c;先贴出比较坑的代码&#xff1a; <template><view class"main"> <view class"tops"…

经过几个小时的努力,终于实现了,根据组件名异常加载组件,直接上代码,网上的很多代码方都有坑,先贴出比较坑的代码:

<template><view class="main">		<view class="tops"><view class="info"><view class="item"><view class="tit">姓名:</view><view class="txt">{{qyUser.name}}</view></view></view></view><view><component :is="dycomp" v-if="isShow"></component></view></view>
</template>
<script setup>
import {  ref, defineAsyncComponent,markRaw } from 'vue';
import { onLoad } from "@dcloudio/uni-app";
import api from '../../api/api.js';
const qyUser = ref({});
//markRaw方法将组件对象标记为非响应式对象
//shallowRef代替ref来创建一个浅响应式对象
const dycomp = ref(null);
const isShow = ref(false);
onLoad(()=>{geQyUserInfo();loadAsyncComponent("mdIndex");	
});
const loadAsyncComponent = (componentName)=>{console.log(componentName);dycomp.value = defineAsyncComponent(() =>{import("../components/"+componentName+".vue");});isShow.value = true;}
const geQyUserInfo = ()=>{console.log(uni.getStorageSync("qyuserid"));api.geQyUserInfo({"qyuserid":uni.getStorageSync("qyuserid"),},(res)=>{qyUser.value = res.data.qyUser;	});
}
</script>
<style lang="scss" scoped>.main {background-color: #f5f6f8;width: 100%;height: 100vh;box-sizing: border-box;padding: 20rpx;.tops {background: #fff;border-radius: 20rpx;padding: 20rpx 20rpx 10rpx;.title {margin-bottom: 25rpx;border-left: 6rpx solid #1296db;padding-left: 10rpx;}.info {.item {display: flex;align-items: center;font-size: 26rpx;margin-bottom: 10rpx;.tit {flex: 1;color: #666;}.txt {flex: 4;}}}}}
</style>

最后优化后成功异步加载组件的代码:

<template><view class="main">		<view class="tops"><view class="info"><view class="item"><view class="tit">姓名:</view><view class="txt">{{qyUser.name}}</view></view></view></view><view><component :is="dycomp" v-if="isShow"></component></view></view>
</template>
<script setup>
import {  ref, defineAsyncComponent,markRaw,shallowRef } from 'vue';
import { onLoad } from "@dcloudio/uni-app";
import api from '../../api/api.js';
const qyUser = ref({});
//markRaw方法将组件对象标记为非响应式对象
//shallowRef代替ref来创建一个浅响应式对象
const dycomp = shallowRef(null);
const isShow = ref(false);
onLoad(()=>{geQyUserInfo();});
const loadAsyncComponent = (componentName)=>{console.log(componentName);dycomp.value = defineAsyncComponent({loader: () => import("../../components/"+componentName+".vue"),delay: 200,timeout: 3000});isShow.value = true;}
const geQyUserInfo = ()=>{api.geQyUserInfo({"qyuserid":uni.getStorageSync("qyuserid"),},(res)=>{qyUser.value = res.data.qyUser;loadAsyncComponent("mdIndex");});
}
</script>
<style lang="scss" scoped>.main {background-color: #f5f6f8;width: 100%;height: 100vh;box-sizing: border-box;padding: 20rpx;.tops {background: #fff;border-radius: 20rpx;padding: 20rpx 20rpx 10rpx;.title {margin-bottom: 25rpx;border-left: 6rpx solid #1296db;padding-left: 10rpx;}.info {.item {display: flex;align-items: center;font-size: 26rpx;margin-bottom: 10rpx;.tit {flex: 1;color: #666;}.txt {flex: 4;}}}}}
</style>
http://www.dinnco.com/news/61809.html

相关文章:

  • 百度品牌网站建设北京有限公司
  • 专业做室内设计的网站有哪些厦门网站到首页排名
  • 小程序开发公司网站源码下载如何注册一个域名
  • wordpress做的网站效果6软文推广案例500字
  • 根据网站做软件近期国内新闻摘抄
  • 软件网站开发市场前景全网seo
  • unity3d做网站竞价排名的定义
  • 企业微网站开发最新疫情最新情况
  • 企业网站建设需要哪些东西搜索引擎优化的定义是什么
  • 网站建设宣传语提高搜索引擎检索效果的方法
  • 做网站和推广莆田百度seo公司
  • 我的常德seo实战培训费用
  • 中英文切换网站怎么做2345网址导航官网
  • 昆明北京网站建设商务网站如何推广
  • 河北汉佳 做网站的公司网站建设的整体流程有哪些
  • 网站规划与建设是什么意思国内外搜索引擎大全
  • 哪里建网站便宜网站搭建谷歌seo
  • 专门给小公司做网站青岛网站推广企业
  • 移动网站建设cnfg培训机构seo
  • 网站服务器租用价格网站优化和网站推广
  • 安徽住房城乡建设厅网站高质量外链购买
  • 信游天下网站建设广告营销策略
  • 做搜索网站2021搜索引擎排名
  • 照片书那个网站做的好百度seo培训公司
  • 做网站的公司 成都百度打广告多少钱一个月
  • 如何利用网站做淘宝联盟如何进行搜索引擎优化?
  • html网页设计基础东莞优化seo
  • 陕西建设厅八大员官方网站在线注册免费域名
  • 大都会app可以删记录吗谷歌seo站内优化
  • 怎么发布php网站沧州seo包年优化软件排名