Files
xk-doctor-wx/utils/workbenchCardPref.js
2026-08-12 08:57:35 +08:00

24 lines
696 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 工作台功能卡片形态偏好(长卡/短卡)
* 存本地 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')
}