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

网站模板之家免费模板hyein seo官网

网站模板之家免费模板,hyein seo官网,广东东莞疫情严重吗,天津港建设公司官网在Vue中,通过使用动态组件,我们可以实现组件的动态切换,从而达到页面的动态展示效果。 vue 中 component组件 is属性 功能描述 例如:有多个tabs标签,如:推荐、热点、视频等。用户点击标签就会切换到对应组…

在Vue中,通过使用动态组件,我们可以实现组件的动态切换,从而达到页面的动态展示效果。

vue 中 component组件 is属性

 功能描述 

例如:有多个tabs标签,如:推荐、热点、视频等。用户点击标签就会切换到对应组件

vue2版

<template><!-- 标签数据 --><!-- uview-ui 标签组件 --><u-tabsclass="tabsBox":list="tabData"@click="changeTab":current="tabsCurrent"></u-tabs><!-- 组件切换 --><component :is="getCurrentCompName"></component>
</template><script>
import CompA from './components/comp-a.vue'
import CompB from './components/comp-b.vue'
import CompC from './components/comp-c.vue'export default {data() {return {tabsCurrent: 0,tabsList: [],}},computed: {getCurrentCompName() {let currentCompName = ''switch (this.tabsCurrent) {case 1:currentCompName = 'CompB'breakcase 2:currentCompName = 'CompC'breakdefault:currentCompName = 'CompA'}return currentCompName},},methods: {toggle(index) {this.tabsCurrent = index},},
}
</script>

vue3版

<template><!-- 标签数据 --><!-- uview-ui 标签组件 --><u-tabsclass="tabsBox":list="tabData"@click="changeTab":current="tabsCurrent"></u-tabs><!-- 组件切换 --><component :is="getCurrentCompName"></component>
</template><script setup>
import { ref, reactive, markRaw} from 'vue';
import CompA from './components/comp-a.vue';
import CompB from './components/comp-b.vue';
import CompC from './components/comp-c.vue';const tabsCurrent = ref(0);
const tabsList = ref([]);const getCurrentCompName = () => {let currentCompName = '';switch (tabsCurrent.value) {case 1:currentCompName = markRaw(CompB);break;case 2:currentCompName = markRaw(CompC);break;default:currentCompName = markRaw(CompA);}return currentCompName;
};const toggle = (index) => {tabsCurrent.value = index;
};
</script>

或者

<template><!-- 标签数据 --><!-- uview-ui 标签组件 --><u-tabsclass="tabsBox":list="tabData"@click="changeTab":current="tabsCurrent"></u-tabs><!-- 组件切换 --><component :is="currentComp"></component>
</template><script setup>
import { ref, reactive, markRaw, shallowRef } from 'vue';
import CompA from './components/comp-a.vue';
import CompB from './components/comp-b.vue';
import CompC from './components/comp-c.vue';const tabsCurrent = ref(0);
const tabsList = ref([]);
const currentComp = shallowRef(CompA)const toggle = (index) => {tabsCurrent.value = index;switch (index) {case 1:currentComp.value = CompB;break;case 2:currentComp.value = CompC;break;default:currentComp.value = CompA;}
};
</script>
http://www.yidumall.com/news/70971.html

相关文章:

  • 用wordpress搭建网站百度关键词首页排名服务
  • 网站建设应走什么会计科目线上营销推广方案有哪些
  • 如何在网站上做评比宁波seo外包公司
  • 更新网站 是否要重启iis淘宝直通车推广怎么做
  • 怎么区分营销型网站it学校培训学校哪个好
  • 软件库合集资料网站手机百度正式版
  • 手机版网站如何做百度 营销怎么收费
  • 网站建设价格热线传播易广告投放平台
  • 网站开发能做什么整站优化推广
  • 建设银行信用卡账网站百度电脑版网址
  • 免费高清视频素材网站有哪些网站快速被百度收录
  • h5免费制作爱站网站长seo综合查询工具
  • 美国打不开国内网站百度网址大全网址导航
  • 图书馆网站结构怎么做产品营销网站建设
  • wordpress 3 企业主题seo网站关键词优化多少钱
  • 银川专业做网站公司企业网站模板
  • 企业准备做网站的准备工作百度seo简爱
  • 音速企业名录搜索软件东莞seo技术
  • 寻找做网站的合作伙伴北京软文范例
  • 2017网站风格互联网推广方式
  • 哪个网站可以做行程攻略杭州seo价格
  • 免费企业网站建设免费网站软件推荐
  • 哪些网站可以做h5互联网100个创业项目
  • 网站做微信小程序号码公司网站怎么建立
  • 学网站建设维护浏览器下载安装
  • wordpress的站点地址(url)百度手游app下载
  • 高校校园网站建设培训班培训心得模板
  • 互联网上市公司排名qq群排名优化软件购买
  • 真人与狗做网站网络营销的内容
  • 南通做百度网站的公司网站站长工具seo综合查询分析