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

企业网站备案系统品牌网站建设代理

企业网站备案系统,品牌网站建设代理,asp建设网站需要了解什么,温州市建设工程管理网站上篇介绍了前端项目部署以及基本依赖的应用#xff0c;这次主要对于路由以及布局进行模块化处理 一、 创建layout模块 1、新建src/layout/index.vue templateel-container classcommon-layout!-- el-aside classaside这次主要对于路由以及布局进行模块化处理 一、 创建layout模块 1、新建src/layout/index.vue templateel-container classcommon-layout!-- el-aside classasideAside//el-aside --el-containerel-header classheaderHeader//el-headerel-main classmainrouter-view/router-view/el-mainel-footer classfooterCopyright © 2020 云风网, All rights reserved. 京ICP备20002789号-1/el-footer/el-container/el-container /templatescript setup langts // import Aside from ./components/aside.vue import Header from ./components/header.vue/scriptstyle langscss scoped import /assets/styles/mixins.scss; .common-layout{width: 100%;height: 100vh;.aside{height: 100vh;width: 200px;}.header{height: 60px;padding: 0;}.main{include scrollBar;}.footer{height: 60px;background-color: #343a40;color: #fff;line-height: 60px;} }/style 2、新建头部组件src/layout/components/header.vue templateel-menu:default-activeactiveIndexclassheader-containermodehorizontal:ellipsisfalseselecthandleSelectel-menu-item index0imgclasslogosrc/assets/logo.svgaltlogo//el-menu-itemnavbar-itemv-for(route, index) in routerList:keyroute.path index:itemroute:base-pathroute.path:is-nestfalse//el-menu /templatescript setup langts import NavbarItem from ./navbarItem.vue; import { useRouter} from vue-router; const router useRouter();const activeIndex ref(1) const routerList router.getRoutes(); console.log(routerList,routerList); const handleSelect (key: string, keyPath: string[]) {console.log(key, keyPath) } /scriptstyle langscss scoped .el-menu--horizontal .el-menu-item:nth-child(1) {margin-right: auto; } .header-container{height: 100%;padding: 0 50px;background-color: #fff;box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);.logo{width: 40px;} } /style 3、新建菜单组件src/layout/components/navbarItem.vue templatediv v-if!item.hiddentemplate v-ifhasOneShowingChild(item.children, item) (!onlyOneChild.children || onlyOneChild.noShowingChildren)app-link v-ifonlyOneChild.meta.title :toresolvePath(onlyOneChild.path, onlyOneChild.query)el-menu-item :indexresolvePath(onlyOneChild.path,) clickhandleClick(item.path)svg-icon :icon-classonlyOneChild.meta.icon || (item.meta item.meta.icon) /template #titlespan classmenu-title :titlehasTitle(onlyOneChild.meta.title){{ onlyOneChild.meta.title }}/span/template/el-menu-item/app-link/templateel-sub-menu v-else refsubMenu :indexresolvePath(item.path,) teleportedtemplate v-ifitem.meta #titlesvg-icon :icon-classitem.meta item.meta.icon /span classmenu-title :titlehasTitle(item.meta.title){{ item.meta.title }}/span/templateapp-link v-forchild in item.children :keychild.path :toresolvePath(child.path, )el-menu-item:itemchildclassnest-menuclickhandleClick(child.path)template #titlespan classmenu-title{{ child.meta.title }}/span/template/el-menu-item/app-link/el-sub-menu/div/templatescript setup langtsimport { isExternal } from /utils/validate.tsimport AppLink from ./Link.vueimport { getNormalPath } from /utils/misinterface MenuItem {path: string;meta?: {icon?: string;title?: string;[key: string]: any;};query?: string;children?: MenuItem[];hidden?: boolean;noShowingChildren?: boolean;}const props defineProps{item: MenuItem;isNest: boolean;basePath: string;}();const onlyOneChild refMenuItem({ path: , meta: {} });function hasOneShowingChild(children: MenuItem[] [], parent: MenuItem): boolean {const showingChildren children.filter(item {if (item.hidden) {return false;} else {onlyOneChild.value item;return true;}});if (showingChildren.length 1) {return true;}if (showingChildren.length 0) {onlyOneChild.value { ...parent, path: , noShowingChildren: true, meta: {} };return true;}return false;}function handleClick(routePath: string) {localStorage.setItem(routePath, routePath);}function resolvePath(routePath: string, routeQuery?: string) {if (isExternal(routePath)) {return routePath;}if (isExternal(props.basePath)) {return props.basePath;}if (routeQuery) {let query JSON.parse(routeQuery);return { path: getNormalPath(${props.basePath}/${routePath}), query };}return getNormalPath(${props.basePath}/${routePath});}function hasTitle(title: string | undefined): string {return title title.length 5 ? title : ;}/script4、新建菜单组件src/layout/components/Link.vue templatecomponent :istype v-bindlinkProps()slot //component /templatescript setup langts import { isExternal } from /utils/validate.tsconst props defineProps({to: {type: [String, Object],required: true} })const isExt computed(() {return isExternal(props.to) })const type computed(() {if (isExt.value) {return a}return router-link })function linkProps() {if (isExt.value) {return {href: props.to,target: _blank,rel: noopener}}return {to: props.to} } /script 5、新建方法封装文件src/utils/validate.ts /*** 判断url是否是http或https * param {string} path* returns {Boolean}*/export function isHttp(url) {return url.indexOf(http://) ! -1 || url.indexOf(https://) ! -1 }/*** 判断path是否为外链* param {string} path* returns {Boolean}*/export function isExternal(path) {return /^(https?:|mailto:|tel:)/.test(path) }/*** param {string} str* returns {Boolean}*/ export function validUsername(str) {const valid_map [admin, editor]return valid_map.indexOf(str.trim()) 0 }/*** param {string} url* returns {Boolean}*/ export function validURL(url) {const reg /^(https?|ftp):\/\/([a-zA-Z0-9.-](:[a-zA-Z0-9.%$-])*)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]\.)*[a-zA-Z0-9-]\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9])*(\/($|[a-zA-Z0-9.,?\\%$#~_-]))*$/return reg.test(url) }/*** param {string} str* returns {Boolean}*/ export function validLowerCase(str) {const reg /^[a-z]$/return reg.test(str) }/*** param {string} str* returns {Boolean}*/ export function validUpperCase(str) {const reg /^[A-Z]$/return reg.test(str) }/*** param {string} str* returns {Boolean}*/ export function validAlphabets(str) {const reg /^[A-Za-z]$/return reg.test(str) }/*** param {string} email* returns {Boolean}*/ export function validEmail(email) {const reg /^(([^()\[\]\\.,;:\s](\.[^()\[\]\\.,;:\s])*)|(.))((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]\.)[a-zA-Z]{2,}))$/return reg.test(email) }/*** param {string} str* returns {Boolean}*/ export function isString(str) {if (typeof str string || str instanceof String) {return true}return false }/*** param {Array} arg* returns {Boolean}*/ export function isArray(arg) {if (typeof Array.isArray undefined) {return Object.prototype.toString.call(arg) [object Array]}return Array.isArray(arg) } 二、修改router/index.ts import { createRouter, createWebHistory } from vue-router import Layout from /layout/index.vue //公共路由 export const constantRoutes [{path: /,component: Layout,redirect: /home,hidden: false,children: [{path: home,name: Home,meta:{ title: 系统知识,routerNum: 0},component: () import(/views/Home.vue)}]},{path: /,redirect: /article,component: Layout,hidden: false,children: [{path: article,name: Article,meta:{ title: 插件管理,routerNum: 1},component: () import(/views/Article.vue)}]},{path: /,redirect: /mix,component: Layout,hidden: false,meta:{ title: 多级菜单,routerNum: 0},children: [{path: home,name: Home,meta:{ title: 系统知识,routerNum: 0},component: () import(/views/Home.vue)},{path: article,name: Article,meta:{ title: 插件管理,routerNum: 1},component: () import(/views/Article.vue)}]},// {// path: /article/:id,// name: Article,// meta:{ title: 插件管理,routerNum: 1},// component: () import(/views/Article.vue)// } ] const router createRouter({history: createWebHistory(),routes: constantRoutes })export default router
http://www.tj-hxxt.cn/news/136476.html

相关文章:

  • 东莞网站推广宣传iis网站无法启动
  • 为古汉字老人做网站网络运营与维护
  • 绵阳的网站制作公司哪家好wordpress 边框大小
  • 一般网站建设公司好抖音代运营合作协议书范本
  • 定制化网站开发报价百度seo网络营销书
  • 网站开发主流程序wordpress应用案例
  • 单页网站建设平台哪个好400电话网络推广商城网站
  • 网站建设方案书阿里云ps做网站广告logo
  • 朝阳淘宝网站建设微网站成功案例
  • 好的网站设计网站搜索网站不显示图片
  • 网站部分版块显示正在建设对于网站建设的意见和建议
  • 搭建淘宝客网站源码帮公司制作网页多少钱
  • 怎么看网站是用什么系统做的app制作需要哪些技术
  • 河北省住房和城乡建设厅的网站高米店网站建设公司
  • 电子商务网站推广策划方案云主机 怎么做网站
  • 白山住房与城乡建设局网站学广告设计需要什么学历
  • 外包做一个网站一般费用wordpress邀请码吧
  • 旅游景点网站设计论文贵州网站开发哪家便宜
  • 网站图片如何居中做360手机网站优化快
  • 手机网站建设价格是多少做网站需要模板吗
  • 一个网站需要多少空间付费阅读wordpress主题
  • 贵港网站建设培训网站建设合同注意点
  • 网站网页区别国外免费个人网站空间
  • 做网站的价格是多少东营建设网站公司电话
  • 网站系统怎么用免费的个人简历模板 医学生
  • 昆明seo网站建设购物网站的搜索框用代码怎么做
  • 智能网站建设软件有哪些方面海口网红图书馆
  • 做网站练手项目网站建设流程是这样的
  • 北京快三下载官方网站推盟
  • 网站开发的职业分析wordpress获取文章一个tag标签