feat: 优化了若干接口,可用性存疑
This commit is contained in:
23
utils/workbenchCardPref.js
Normal file
23
utils/workbenchCardPref.js
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 工作台功能卡片形态偏好(长卡/短卡)
|
||||
* 存本地 storage(已确认不入库):用户在「我的」页切换后,各工作台首页 onShow 时读取生效
|
||||
* short = 双列短卡(默认);long = 整行长卡
|
||||
*/
|
||||
|
||||
const STORAGE_KEY = 'wb_card_style'
|
||||
|
||||
/**
|
||||
* 读取卡片形态偏好,异常值一律回落 short,保证布局不会因脏数据坏掉
|
||||
*/
|
||||
export function getCardStyle() {
|
||||
const value = uni.getStorageSync(STORAGE_KEY)
|
||||
return value === 'long' ? 'long' : 'short'
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入卡片形态偏好
|
||||
* @param {'short'|'long'} style
|
||||
*/
|
||||
export function setCardStyle(style) {
|
||||
uni.setStorageSync(STORAGE_KEY, style === 'long' ? 'long' : 'short')
|
||||
}
|
||||
Reference in New Issue
Block a user