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

给canvas写style,比如绝对定位,会出现taro-canvas-core和canvas两次定位 #6990

Closed
shenghanqin opened this issue Jul 10, 2020 · 4 comments · Fixed by #7223 or #7257
Closed
Assignees
Labels
A-components Area - H5 组件库相关 F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x
Milestone

Comments

@shenghanqin
Copy link
Collaborator

shenghanqin commented Jul 10, 2020

相关平台

H5

复现仓库

https://github.com/hi-our/hi-face/blob/7556d5f2ce5a6c16d38d5b62e87291f7ee5c7c94/taro/src/components/taro-cropper/index.tsx#L616
浏览器版本: chrome最新版
使用框架: React

复现步骤

在微信小程序上是正常的,只有一个canvas元素
但在h5端会出现嵌套的情况

期望结果

期望为减少DOM层级或者style减少一个赋值

实际结果

style有问题

环境信息

Taro CLI  3.0.2  environment info:
    System:
      OS: macOS 10.15.5
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 12.16.2 - ~/.nvm/versions/node/v12.16.2/bin/node
      Yarn: 1.22.0 - ~/.yarn/bin/yarn
      npm: 6.14.4 - ~/.nvm/versions/node/v12.16.2/bin/npm
    npmPackages:
      @tarojs/cli: 3.0.2 => 3.0.2 
      @tarojs/components: 3.0.2 => 3.0.2 
      @tarojs/mini-runner: 3.0.2 => 3.0.2 
      @tarojs/taro: 3.0.2 => 3.0.2 
      @tarojs/webpack-runner: ^3.0.2 => 3.0.2 
      eslint-config-taro: 3.0.2 => 3.0.2 
      react: ^16.10.0 => 16.13.1 


补充信息

项目配置

const alias = require('./alias')
const loadEnv = require('../load-env')

loadEnv()


// 兼容web端和小程序端
const dpr = process.env.TARO_ENV === 'h5' ? 1 : 2


const config = {
  projectName: 'quickly-mask',
  date: '2019-11-2',
  designWidth: 375 * dpr,
  deviceRatio: {
    640: 2.34 / 2 / dpr,
    750: 1 / 1 / dpr,
    828: 1.81 / 2 / dpr
  },
  sourceRoot: 'src',
  outputRoot: process.env.TARO_ENV === 'h5' ? 'dist-h5' : 'dist',
  plugins: [],
  defineConstants: {
  },
  copy: {
    patterns: [
    ],
    options: {
    }
  },
  alias,
  framework: 'react',
  mini: {
    imageUrlLoaderOption: {
      limit: 0
    },
    postcss: {
      pxtransform: {
        enable: true,
        config: {

        }
      },
      url: {
        enable: true,
        config: {
          limit: 1024 // 设定转换尺寸上限
        }
      },
      cssModules: {
        enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
        config: {
          namingPattern: 'module', // 转换模式,取值为 global/module
          generateScopedName: '[name]__[local]___[hash:base64:5]'
        }
      }
    }

  },
  h5: {
    publicPath: '/',
    staticDirectory: 'static',
    postcss: {
      autoprefixer: {
        enable: true,
        config: {
          browsers: [
            'last 3 versions',
            'Android >= 4.1',
            'ios >= 8'
          ]
        }
      },
      cssModules: {
        enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
        config: {
          namingPattern: 'module', // 转换模式,取值为 global/module
          generateScopedName: '[name]__[local]___[hash:base64:5]'
        }
      }
    }
  }
}

module.exports = function (merge) {
  if (process.env.NODE_ENV === 'development') {
    return merge({}, config, require('./dev'))
  }
  return merge({}, config, require('./prod'))
}
@shenghanqin shenghanqin added the A-components Area - H5 组件库相关 label Jul 10, 2020
@taro-bot2 taro-bot2 bot added F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x labels Jul 10, 2020
@Chen-jj Chen-jj self-assigned this Jul 10, 2020
@shenghanqin
Copy link
Collaborator Author

没有跟进的?

@shenghanqin
Copy link
Collaborator Author

请各位帮忙跟进一下? @luckyadam @yuche @Chen-jj

@Junzibuzhengyibuqi
Copy link

此次修复前
image
修复后
image

大佬再改什么啊

@shenghanqin
Copy link
Collaborator Author

此次修复前
image
修复后
image

大佬再改什么啊

你这后来ok了吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-components Area - H5 组件库相关 F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants