com.js 405 B

123456789101112131415161718
  1. export const commonProps = {
  2. bgColor: {
  3. type: String,
  4. default: '#fff'
  5. },
  6. customStyle: {
  7. type: Object,
  8. default: () => ({})
  9. }
  10. }
  11. export const str2px = str => {
  12. if (!str) return 0
  13. str = String(str)
  14. if (str.endsWith('rpx')) return uni.upx2px(parseInt(str))
  15. if (str.endsWith('px')) return parseInt(str)
  16. return parseInt(str)
  17. }