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

Map的includePoints设置无效 #7178

Closed
qilovehua opened this issue Jul 27, 2020 · 5 comments · Fixed by #7223
Closed

Map的includePoints设置无效 #7178

qilovehua opened this issue Jul 27, 2020 · 5 comments · Fixed by #7223
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Milestone

Comments

@qilovehua
Copy link

qilovehua commented Jul 27, 2020

相关平台

微信小程序

复现仓库

https://github.com/qilovehua/taro-map
小程序基础库: 2.1.2
使用框架: React

复现步骤


markers里有两个marker,points也有两个点,map上显示了两个marker,但没有同时显示这两个marker
输出的wxml里没有include_points字段,被忽略了?
微信小程序会优先显示所有include_points重新计算中心位置的

期望结果

两个marker能显示出来
22

实际结果

只显示了其中一个marker,另一个距离远点无法显示,移动地图才能看到
11

环境信息

Taro CLI 3.0.5 environment info:
    System:
      OS: macOS 10.15.2
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 10.16.3 - ~/.nvm/versions/node/v10.16.3/bin/node
      Yarn: 1.12.3 - /usr/local/bin/yarn
      npm: 6.9.0 - ~/.nvm/versions/node/v10.16.3/bin/npm
    npmPackages:
      @tarojs/components: 3.0.5 => 3.0.5 
      @tarojs/mini-runner: 3.0.5 => 3.0.5 
      @tarojs/react: 3.0.5 => 3.0.5 
      @tarojs/runtime: 3.0.5 => 3.0.5 
      @tarojs/taro: 3.0.5 => 3.0.5 
      @tarojs/webpack-runner: 3.0.5 => 3.0.5 
      babel-preset-taro: 3.0.5 => 3.0.5 
      eslint-config-taro: 3.0.5 => 3.0.5 
      react: ^16.10.0 => 16.13.1
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Jul 27, 2020
@Chen-jj
Copy link
Contributor

Chen-jj commented Jul 29, 2020

@qilovehua 复现仓库你这样写:github.com/no-demo,别人如何帮你定位问题?

@qilovehua
Copy link
Author

@qilovehua 复现仓库你这样写:github.com/no-demo,别人如何帮你定位问题?

实在抱歉,已经更新了

@Chen-jj Chen-jj added this to the 3.0.7 milestone Jul 29, 2020
@Chen-jj
Copy link
Contributor

Chen-jj commented Jul 31, 2020

@qilovehua 关于这个问题,Taro 和你的写法都要修改。

Taro 需要修改的地方(3.0.7修复)

  • include-point 属性名应该改成 include-points

你需要修改的地方

export default function () {
  const longitude = (121.474275 + 121.549892) / 2
  const latitude = (31.233541 + 31.242274) / 2
  const ms = [{
    longitude: 121.474275,
    latitude: 31.233541,
    width: 40,
    height: 40,
    iconPath: icon,
  }, {
    longitude: 121.549892,
    latitude: 31.242274,
    width: 40,
    height: 40,
    iconPath: icon,
  }]
  const points = ms.map(item => ({ longitude: item.longitude, latitude: item.latitude }))
  return (
    <View>
        <Map style='width: 100vw; height: 100vh;' longitude={longitude} scale={0} latitude={latitude} markers={ms} includePoints={points} setting={{}} />
    </View>
  )
}

@qilovehua
Copy link
Author

@Chen-jj

我微信小程序里这么写是有效的,include-points的优先级更高,会忽略scale、longitude与latitude
等3.0.7出来后我再试试吧

@Tutao1995
Copy link

还是不行



这样子谢了includePoints属性之后 ,页面无缩放

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants