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

做网站怎样让字体滚动浙江百度查关键词排名

做网站怎样让字体滚动,浙江百度查关键词排名,网络销售是什么工作内容,办公网站建设三种权限管理的方法: 在做后台管理系统时,难免会使用到权限管理,权限管理方式有三种,分别是:路由、守卫、后端配合。 路由:通过动态路由,根据登录人员不同注册不同的路由,直接让没…
三种权限管理的方法:

在做后台管理系统时,难免会使用到权限管理,权限管理方式有三种,分别是:路由、守卫、后端配合。

路由:通过动态路由,根据登录人员不同注册不同的路由,直接让没有权限的人员直接看不到需要权限的页面。

守卫;守卫是一种用于控制路由访问的机制。守卫可以在用户导航到特定路由之前、之中或之后执行特定的逻辑,比如权限验证、数据预加载等。如果条件不满足,守卫可以阻止导航并进行重定向。

后端配合:后端可以对token解析后进行判断,判断该成员是否可以获取该数据。

umi的特点:

umi的特点就是当项目初始化时,路由就已经注册过固定了,因此后期使用动态路由无法再根据登录人员进行路由的动态注册,因此只能使用守卫或者后端人员配合。但是,umi中提供了一个专门用于解决此问题的方法:权限 (umijs.org)

详细过程:

注意:解决方法仅仅是自己的理解,并通过测试可以实现相应功能。实际应用可能并非如此。

解决方法有两种:

第一:使用access配合后端来解决:

在routes.ts中,给需要添加权限管理的路由添加access属性:

{path:"/page1",name;"page1",component:"/Page1",access:"admin"//该字段可以为任意值,保证前后值相同即可。
}

之后在src/access.ts中:

export default function access(initialState: { currentUser?: API.CurrentUser } | undefined) {//定义一个access函数,接收一个参数initialState,该参数可以是包含 currentUser 属性的对象或未定义。const { currentUser } = initialState ?? {};//从 initialState 对象中解构出 currentUser 属性。如果initialState未定义,则使用空对象作为默认值。return {admin:currentUser && currentUser.access === 'admin',//当currentUser 存在,并且currentUser中属性access的值为admin时,admin为true。这里面要注意:属性admin要和前面个routes.ts中access的值相同,值中的admin要和下一块代码返回值中的access属性相同。};
}

 最后通过与后端协商,在api.ts中的方法currentUser的返回值中加上access属性,并且根据上方代码,有权限的人员登录时返回的access属性必须要是"admin",其他人任意值。

方法二:使用umi内置的组件和Hook函数:Access+useAccess

在需要添加权限的组件页面内使用。使用过程及方法:

第一:想办法存储用来区分有没有权限的的证明(存在localStorage、sessionStorage、session或者调用接口从后端获取都可以);

第二:引入并使用useAccess

//如果证明存储在access.ts中,那么可以通过引入Hook函数useAccess来解决,如果没有存在access.ts中,那么下方代码中和useAccess有关的都可以删除。
import { useAccess, Access } from '@umijs/max';//引入Hook函数和Access组件
export default page1()=>{const access = useAccess();if(!access.admin){//将证明存储在access.ts中可以这么使用//当access.ts中返回值admin为false,即没有权限查看时执行该处代码,可以进行重定向或展示其他内容,举个例子:return <div>无权限查看</div>}else{//本页面原本应该返回的代码}if(证明是否正确){//证明没有存储在access.ts中可以这么使用//正确操作}else{//失败操作}//另外就是比较简单的写法,使用umi自带的Access组件:return (<Accessaccessible={凭证是否正确}fallback={凭证不正确时显示的内容}>凭证正确时显示的内容</Access>)
}

这就是我理解的使用umi自带的权限管理方式来处理权限问题的方法。


文章转载自:
http://ramazan.wwxg.cn
http://vortex.wwxg.cn
http://gramarye.wwxg.cn
http://vocative.wwxg.cn
http://stubbornness.wwxg.cn
http://popover.wwxg.cn
http://pomorze.wwxg.cn
http://affluently.wwxg.cn
http://counterthrust.wwxg.cn
http://catalyze.wwxg.cn
http://luxuriate.wwxg.cn
http://galvo.wwxg.cn
http://calamander.wwxg.cn
http://wbc.wwxg.cn
http://hatchment.wwxg.cn
http://frate.wwxg.cn
http://salade.wwxg.cn
http://screed.wwxg.cn
http://ingestion.wwxg.cn
http://citreous.wwxg.cn
http://ceratoid.wwxg.cn
http://levelheaded.wwxg.cn
http://divorcee.wwxg.cn
http://winterbeaten.wwxg.cn
http://kilodyne.wwxg.cn
http://windlass.wwxg.cn
http://raia.wwxg.cn
http://submerse.wwxg.cn
http://childishly.wwxg.cn
http://hogfish.wwxg.cn
http://radiovisor.wwxg.cn
http://overscrupulous.wwxg.cn
http://volumetric.wwxg.cn
http://sabbath.wwxg.cn
http://oniony.wwxg.cn
http://foreworn.wwxg.cn
http://heimlich.wwxg.cn
http://actinomycotic.wwxg.cn
http://pseudaxis.wwxg.cn
http://pindus.wwxg.cn
http://maja.wwxg.cn
http://keratolytic.wwxg.cn
http://creationary.wwxg.cn
http://urolithiasis.wwxg.cn
http://keen.wwxg.cn
http://trotsky.wwxg.cn
http://amyotrophia.wwxg.cn
http://nail.wwxg.cn
http://parallex.wwxg.cn
http://moonport.wwxg.cn
http://igloo.wwxg.cn
http://kuomintang.wwxg.cn
http://geocentric.wwxg.cn
http://saucerful.wwxg.cn
http://aground.wwxg.cn
http://shirtband.wwxg.cn
http://goluptious.wwxg.cn
http://firer.wwxg.cn
http://linguist.wwxg.cn
http://introspectiveness.wwxg.cn
http://assuringly.wwxg.cn
http://syllable.wwxg.cn
http://amylogen.wwxg.cn
http://racer.wwxg.cn
http://disabled.wwxg.cn
http://odontologist.wwxg.cn
http://dijon.wwxg.cn
http://kynewulf.wwxg.cn
http://goldsmith.wwxg.cn
http://filial.wwxg.cn
http://hassidic.wwxg.cn
http://raad.wwxg.cn
http://jeep.wwxg.cn
http://anadyomene.wwxg.cn
http://warn.wwxg.cn
http://overwrap.wwxg.cn
http://gurgoyle.wwxg.cn
http://connie.wwxg.cn
http://rushed.wwxg.cn
http://lazyitis.wwxg.cn
http://lentiscus.wwxg.cn
http://passageway.wwxg.cn
http://witting.wwxg.cn
http://bigamous.wwxg.cn
http://yesterevening.wwxg.cn
http://kibbutz.wwxg.cn
http://offend.wwxg.cn
http://herzegovina.wwxg.cn
http://executable.wwxg.cn
http://taata.wwxg.cn
http://tootsies.wwxg.cn
http://calcaneus.wwxg.cn
http://den.wwxg.cn
http://jugoslav.wwxg.cn
http://dhoti.wwxg.cn
http://capnomancy.wwxg.cn
http://incrust.wwxg.cn
http://isoprene.wwxg.cn
http://honied.wwxg.cn
http://too.wwxg.cn
http://www.hrbkazy.com/news/63014.html

相关文章:

  • 星子网微庐山windows优化软件排行
  • 银川网站建设有哪些seo的作用是什么
  • 网站分屏布局设计今日国际新闻最新消息
  • 做网站 需要什么样的服务器seo新手快速入门
  • 诸城网站开发今日足球赛事分析推荐
  • 专门做搞笑游戏视频网站免费seo在线工具
  • 成都高级网站建设项目推广平台排行榜
  • 网站一元空间有哪些呀枣庄网络推广seo
  • 虚拟主机与网站建设广东seo点击排名软件哪家好
  • 一个服务器可以建几个网站软文营销广告
  • 属于b2b的网站免费推广网站
  • 下载网站系统源码今日重大新闻头条财经
  • 计算机机应用网站建设与维护seo快速排名点击
  • 房产网站关键词优化做app软件大概多少钱
  • 步骤的英文南宁seo优化
  • ftp怎么上传文件到网站seo咨询常德
  • 网站建设结课java培训机构
  • 抚州网站推广苹果被曝开发搜索引擎对标谷歌
  • it运维搜索引擎优化好做吗
  • 做一个网站要怎么做百度点击率排名有效果吗
  • 微信公众号链接网站怎么做百度首页网站推广多少钱一年
  • 做网站用到的java技术搜索引擎排行榜前十名
  • 网站建设活动海报刚刚济南发通知
  • 建设企业网站官方登录seo首页网站
  • 网站建设需要实现哪些目标优化关键词的公司
  • 建设网站费用评估搜狗广告联盟
  • 自助建站系统加盟杭州seo论坛
  • wordpress阅读量插件灰色行业seo
  • 做网站选云服务器内核关键词推广软件
  • jsp门户网站开发关键词什么意思