Skip to content

Commit

Permalink
fix(runtime): SVGElement not defined since vue@3.0.8 (#8994)
Browse files Browse the repository at this point in the history
* fix(runtime): add createElementNS for fake svg support

* fix(mini-runner): alias SVGElement to TaroElement

* chore: remove unnecessary comma

* chore: skip ts check of unused parameters
  • Loading branch information
b2nil authored Mar 31, 2021
1 parent 22b0ce5 commit b356549
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/taro-mini-runner/src/webpack/build.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ export default (appPath: string, mode, config: Partial<IBuildConfig>): any => {
navigator: ['@tarojs/runtime', 'navigator'],
requestAnimationFrame: ['@tarojs/runtime', 'requestAnimationFrame'],
cancelAnimationFrame: ['@tarojs/runtime', 'cancelAnimationFrame'],
Element: ['@tarojs/runtime', 'TaroElement']
Element: ['@tarojs/runtime', 'TaroElement'],
SVGElement: ['@tarojs/runtime', 'TaroElement']
})

const isCssoEnabled = !((csso && csso.enable === false))
Expand Down
6 changes: 6 additions & 0 deletions packages/taro-runtime/src/bom/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ export class TaroDocument extends TaroElement {
return new TaroElement(NodeType.ELEMENT_NODE, type)
}

// an ugly fake createElementNS to deal with @vue/runtime-dom's
// support mounting app to svg container since vue@3.0.8
public createElementNS (_svgNS: string, type: string) {
return this.createElement(type)
}

public createTextNode (text: string) {
return new TaroText(text)
}
Expand Down

0 comments on commit b356549

Please sign in to comment.