如果用户“无法”执行某项操作,如何使用text=input("Please enter the string to encode")
encoded=[]
index=0
amount=1
while index<=(len(text)-1):
if index==(len(text)-1) or text[index]!=text[(index+1)]:
encoded.append((text[index],amount))
amount=1
else:
amount=amount+1
index=index+1
print(encoded)
显示子组件?
我之所以问这个问题,是因为如果用户未被授权但处于禁用状态,我仍然想渲染组件。
示例:
我想做什么:
@casl/react
答案 0 :(得分:0)
忘了我只能检查一下能力
<button disabled={!abilities.can('update', 'style')}> Update </button>
答案 1 :(得分:0)
<Can>
支持not
道具:
<Can not do="update" on="style">...</Can>