Comments (1)
这个锁屏功能本身也是做着玩的,如果仅靠纯前端做锁屏,肯定是不够严谨的,稍微懂点浏览器调试技巧的都可以轻松破解,防君子不防小人的
当然,你也可以做的更严谨一些,例如:如果当前处于锁屏状态的话,你可以监听 localStorage
的修改,然后对于锁屏时的任何修改都立刻重置回修改前的状态就可以了。
未经测试的伪代码如下:
import { watch } from 'vue'
import { useStorage } from '@vueuse/core'
import { cloneDeep, isEqual }
// 锁屏前的值
let afterLockValue
const state = useStorage('my-store', { hello: 'hi', greeting: 'Hello' })
watch(IS_LOCKSCREEN, (val, oldValue) => {
// 保存刚锁屏时的状态
if (val) {
afterLockValue = deepClone(state.value)
}
})
watch(state, (val) => {
// 如果当前处于锁屏状态,则对localstorage的任何修改重置回锁屏时的状态
if (IS_LOCKSCREEN && !isEqual(val, beforLockValue)) {
state.value = afterLockValue
}
})
from vue3-antdv-admin.
Related Issues (20)
- Table的动态列怎么设置?
- 不能使用unplugin-auto-import这个插件吗? HOT 1
- Date rank filter HOT 1
- How to use BasicForm? HOT 1
- 代理地址访问不了了? HOT 1
- 请问 public/iconfont.js 中有哪些图标,如何查看? HOT 1
- 您NodeJs是用哪个版本的?我npm install还跑不起来 HOT 3
- 注释 demos 路由后会报错 HOT 2
- 大概什么时候趋于稳定,想用于生产 HOT 1
- feature: 新功能,请问有计划对 H5 适配计划吗? HOT 2
- 期待电商 sku 功能
- Node 18.17, pnpm dev ,运行出错error when starting dev server: Error: read ECONNRESET at AxiosError.from HOT 2
- 部署到服务器,直接报错了,不知道是否可以指导一下? HOT 15
- 关于导出excel的例子 HOT 3
- 菜单BUG
- 请问当前是否支持 eslint autofix onsave? HOT 1
- 退出功能有点小问题,没有退出到登录页面 HOT 1
- 弹窗内容太长了,看不到提交和取消按钮。只能拖动弹窗页面才能显示出现 HOT 1
- 大佬,删除demo相关文件以及路由报错问题 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue3-antdv-admin.