h5
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
802 B

const getters = {
// 所有的日常任务 永久 + 可变 日常任务
globals({ dailyTasks, permanents }) {
let arr = [...permanents, ...dailyTasks];
let tempArr = [], flag = false;
arr.forEach(item => {
const index = tempArr.findIndex(val => val.id === item.id);
if (index === -1) tempArr.push(item);
})
return [...tempArr];
},
unitConfig({ timeUnit }) {
const target = uni.$timeConfig.timeUnits.find(item => item.id === timeUnit);
return target;
},
// 计算任务开始时间的格式
startTimeFormat(state, { unitConfig }) {
return unitConfig.format || 'D日 HH:mm';
},
// 计算颗粒度 对应的 dayjs add 的单位
timeGranularity(state, { unitConfig }) {
return unitConfig.granularity;
},
};
export default getters;