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

BUG: 编译到 wxml 时空格变成换行,导致错误 #992

Closed
fjc0k opened this issue Nov 2, 2018 · 2 comments
Closed

BUG: 编译到 wxml 时空格变成换行,导致错误 #992

fjc0k opened this issue Nov 2, 2018 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@fjc0k
Copy link
Contributor

fjc0k commented Nov 2, 2018

问题描述

这是代码:

code

它会被编译为:

code

显而易见,wxml 中 下拉加载更多 前的 - 留在了上一行。

开发者工具中的错误提示如下:

image

复现步骤

如上,提供下代码:

import { View } from '@tarojs/components'
import { Component } from '@tarojs/taro'
import { More } from '../../store'
import './index.scss'

export default class Loading extends Component<{
  more?: More['more']
}> {
  render () {
    const more = this.props.more
    return (
      <View className='loading'>
        {(
          !more || more.loading ? '加载中...' :
          more.finished ? '- 我也是有底线的 -' :
          '- 下拉加载更多 -'
        )}
      </View>
    )
  }
}

系统信息

  • 操作系统: win8
  • Taro 版本: ^1.1.0
  • Node.js 版本: v10.11.0
  • 报错平台: weapp
@yuche yuche added bug Something isn't working 编译器 labels Nov 4, 2018
@yuche yuche self-assigned this Nov 4, 2018
@yuche
Copy link
Contributor

yuche commented Nov 5, 2018

看了一下原因在于使用依赖的 wxml 格式化库无法解析三元表达式嵌套的情况,我们将在 prettier/prettier@5e8a4a1 发布版本之后使用 prettier 作为格式化 wxml 的依赖。

@fjc0k
Copy link
Contributor Author

fjc0k commented Nov 5, 2018

@yuche 测试把 - 下拉加载更多 - 去除空格后改为 -下拉加载更多- 则一切正常。期待修复🎈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants