preact
preact copied to clipboard
当我使用preact和 //translate.google.com/translate_a/element.js 时,会渲染不正确
渲染的错误Dom元素,包含了翻译之前的文字:
渲染的正确Dom元素:
Please use this patch: https://gist.github.com/developit/3e807962630ddbd4977cbd07b597f24f
I've spoken to the Translate team about this and suggested fixes, but it will take a long time.
How should I use this patch There is a problem with the options variable
@lvzegeng - sorry, I forgot to include the import. I have updated the Gist, it should work now.
Just import this before any rendering happens:
import { render } from 'preact';
import './preact-google-translate-patch';
render(...);
Hello @developit I'm having the same problem and I have tried to use the patch but by the nature of the project I'm working on everything gets rendered using portals (it's a nav). Do you know how could I apply the patch to work for this scenario? Thanks!
This how I tried to use it.
/** @jsx h */
import { FunctionalComponent, VNode } from 'preact';
import { createPortal } from 'preact/compat';
import '../../utils/translationFix';