b2nil / taro-ui-vue3

采用 Vue 3.0 重写的 Taro UI 组件库
https://b2nil.github.io/taro-ui-vue3/
MIT License
160 stars 51 forks source link

正常步骤安装vue3的默认模版,编译后weapp报错 #71

Closed lianxin255 closed 3 years ago

lianxin255 commented 3 years ago

问题描述

正常步骤安装vue3的默认模版,编译后weapp报错

版本信息

v1.0.0-alpha.17

涉及的平台

weapp

错误信息

VM209 WAService.js:2 ReferenceError: Element is not defined
    at Object.app.mount (runtime-dom.esm-bundler.js:1221)
    at EA.value (vue3.ts:162)
    at EA.<anonymous> (VM209 WAService.js:2)
    at new EA (VM209 WAService.js:2)
    at Function.<anonymous> (VM209 WAService.js:2)
    at VM209 WAService.js:2
    at Module../src/app.ts (app.ts?c593:8)
    at __webpack_require__ (bootstrap:79)
    at checkDeferredModules (bootstrap:45)
    at Array.webpackJsonpCallback [as push] (bootstrap:32)
VM209 WAService.js:2 TypeError: Cannot read property '$forceUpdate' of undefined
    at Object.updateAppInstance (vue3.ts:143)
    at Object.mount (vue3.ts:134)
    at mount (common.ts:119)
    at ge.onLoad (common.ts:133)
    at ge.<anonymous> (VM209 WAService.js:2)
    at ge.c.__callPageLifeTime__ (VM209 WAService.js:2)
    at Ge (VM209 WAService.js:2)
    at Te (VM209 WAService.js:2)
    at Function.<anonymous> (VM209 WAService.js:2)
    at i.<anonymous> (VM209 WAService.js:2)

代码

// code here
b2nil commented 3 years ago

@1933467270

这是 @vue/runtime-dom 最近的一次变更 fix(runtime-dom): support mounting app on ShadowRoot 导致 Taro 运行时 @tarojs/runtime 报错,详情在这里:[Bug Report]Vue3 适配的 bug

Taro 官方已经修复该问题,但还没发布新的版本。暂时可以把 Vue 3.0 的版本降到 v3.0.4

abearxiong commented 3 years ago

image

这个吧, node_modules/@tarojs/mini-runner/dist/webpack/build.conf.js

104行,

vue降下去是一样的

b2nil commented 3 years ago

当然,按照上面所说改 @tarojs/mini-runner 也行。