product:优化商品列表的样式、实现代码

This commit is contained in:
YunaiV
2023-10-01 19:44:13 +08:00
parent 654094b4fd
commit 3a9668d632
5 changed files with 68 additions and 96 deletions

View File

@ -230,6 +230,7 @@ export const yuanToFen = (amount: string | number): number => {
/**
* 分转元
*/
export const fenToYuan = (amount: string | number): number => {
return Number((Number(amount) / 100).toFixed(2))
export const fenToYuan = (price: string | number): number => {
price = Number(price)
return (price / 100.0).toFixed(2)
}

View File

@ -13,7 +13,8 @@ export const defaultProps = {
children: 'children',
label: 'name',
value: 'id',
isLeaf: 'leaf'
isLeaf: 'leaf',
emitPath: false // 用于 cascader 组件:在选中节点改变时,是否返回由该节点所在的各级菜单的值所组成的数组,若设置 false则只返回该节点的值
}
const getConfig = (config: Partial<TreeHelperConfig>) => Object.assign({}, DEFAULT_CONFIG, config)
@ -377,10 +378,10 @@ export const treeToString = (tree: any[], nodeId) => {
function performAThoroughValidation(arr) {
for (const item of arr) {
if (item.id === nodeId) {
str += `/${item.name}`
str += ` / ${item.name}`
return true
} else if (typeof item.children !== 'undefined' && item.children.length !== 0) {
str += `/${item.name}`
str += ` / ${item.name}`
if (performAThoroughValidation(item.children)) {
return true
}