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

小程序中Text标签dev和build后表现不一致 #1609

Closed
schinvendy opened this issue Dec 20, 2018 · 5 comments
Closed

小程序中Text标签dev和build后表现不一致 #1609

schinvendy opened this issue Dec 20, 2018 · 5 comments
Labels
question Further information is requested

Comments

@schinvendy
Copy link

问题描述

小程序中Text标签如果里面的内容有出现换行的话,dev和build的表现会不一致。

复现步骤

jsx内容:
x1mgtt 313 0dm jpi4irh

dev环境下:
r7hy l57z0cnz2 9q_i9naq

build环境下:
fb_ 8 ht _h 8z 8 4 1 q

期望行为

期望表现一致,避免dev下正常然而到了build后布局混乱

系统信息
Taro CLI 1.2.0 environment info:
System:
OS: Windows 10
Binaries:
Node: 10.13.0 - D:\nodejs\node.EXE
npm: 6.4.1 - D:\nodejs\npm.CMD

@taro-bot
Copy link

taro-bot bot commented Dec 20, 2018

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@yuche
Copy link
Contributor

yuche commented Dec 20, 2018

你截图的代码文字发一下

@schinvendy
Copy link
Author

schinvendy commented Dec 20, 2018

你截图的代码文字发一下

 state = {
    testText: 'testText',
    stateText: 'stateText'
  };

render() {
    const { testText, stateText } = this.state;
    return (
      <View className="index">
        <View>测试Text标签</View>
        <View style="margin-top:20px">
          <Text>
            这是一个被换行的Text标签内容
            {testText}
          </Text>
          <Text>这是一个没有换行的Text标签内容{stateText}</Text>
        </View>
        <View style="margin-top:20px">
          <Text>
            这是一个被换行的Text标签内容
            {stateText}
          </Text>
          <Text>这是一个没有换行的Text标签内容{testText}</Text>
        </View>
      </View>
    );
  }

@yuche
Copy link
Contributor

yuche commented Dec 20, 2018

带上缩进,否则不知道你到底在哪写了 \n

@luckyadam
Copy link
Member

因为 build 后 wxml 会被压缩,你如果要实现换行还是用 <View /> 标签来做

@luckyadam luckyadam added enhancement New feature or request answered question Further information is requested and removed enhancement New feature or request labels Dec 20, 2018
@yuche yuche closed this as completed in 9f873f6 Dec 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants