Skip to content

computed 计算属性返回的类名在小程序中没有转换 #27

@chasonma

Description

@chasonma

例如:

const itemClass = computed(() => {
  if (props.type === 'news') {
    return 'w-[220rpx]'
  }
  return 'w-[340rpx]'
})

目前采取的解决方式:

const itemClass = computed(() => {
  let str
  if (props.type === 'news') {
    str = 'w-[220rpx]'
    // #ifdef MP
    str = 'w--220rpx-'
    // #endif
  } else {
    str = 'w-[340rpx]'
    // #ifdef MP
    str = 'w--340rpx-'
    // #endif
  }
  return str
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions