Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

过滤器中逻辑判断条件else if (999999 >= +data > 9999) {} 这种写法不起作用 #574

Closed
skillnull opened this issue Mar 8, 2019 · 1 comment

Comments

@skillnull
Copy link

// 数据优化过滤器
template.defaults.imports.dataOptimize = function (data) {
    var resultData = ''
    if (+data > 999999) {
        resultData = (+data / 10000).toFixed(0) + '万'
    } else if (999999 >= +data > 9999) { 
        resultData = (+data / 10000).toFixed(2) + '万'
    } else {
        resultData = +data
    }
    return resultData
}
else if (999999 >= +data > 9999) { 
        resultData = (+data / 10000).toFixed(2) + '万'
 } 
这个判断条件不生效
换成这种写法生效
else if (999999 >= +data  && +data > 9999) {
        resultData = (+data / 10000).toFixed(2) + '万'
}

image

@aui
Copy link
Owner

aui commented Apr 26, 2019

你的问题似乎和模板没关系?

@aui aui closed this as completed Apr 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants