新特性:
特性详情:
https://juejin.im/post/5e4487b3e51d4527214ba6b1
文档:
https://taro-docs.jd.com/taro/docs/next/README
旧版本迁移指南:
https://taro-docs.jd.com/taro/docs/next/migration
如有问题可以可在 issue 下回复。
相较于 Alpha 版,Beta 版主要添加了 H5 的支持。把 Taro 相关依赖(包括 babel-preset-taro 等)全部更新到 beta 之后,使用 NPM 安装 H5 端编译系统即可编译:
$ npm i -D @tarojs/webpack-runner@next
和小程序一样,Taro Next 的 H5 端相较于之前版本的 Taro 是一次彻底的重写:基础组件现在全部使用 Web Components 构建,路由系统也完全与前端框架解耦,因此在 H5 端 Taro 也实现了跨框架。但和小程序不同的是,Taro Next H5 端并没有那么长时间的内部测试,还有一些内容需要完善。
Beta 更新详情:
https://gist.github.com/yuche/dcebd9a2a4e95b1c4b60d8eddb5b75e0
next 非常不错,项目里只需要加几个依赖,把
import Taro, { useEffect, useLayoutEffect, useReducer, useState, useContext, useRef, useCallback, useMemo, useRouter, useScope, useTabItemTap, useResize, useReachBottom, usePullDownRefresh, useDidHide, useDidShow, usePageScroll } from '@tarojs/taro'
换成
import React, { Component, useEffect, useLayoutEffect, useReducer, useState, useContext, useRef, useCallback, useMemo, } from 'react'
import Taro, { Current, useRouter, useScope, useTabItemTap, useResize, useReachBottom, usePullDownRefresh, useDidHide, useDidShow, usePageScroll } from '@tarojs/taro'
就可以完成迁移,其他代码都不用动,已经用在正式项目上了
在支付宝端【测试了淘宝端,其他端未测试】
useScope 的使用会导致报错,页面空白:
useScope()会导致如下报错
The above error occurred in the <Index> component:
in Index
in root
in Unknown (created by AppWrapper)
in App (created by AppWrapper)
in AppWrapper
Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries.
TypeError: Object(...) is not a function
at Index (index.js:79)
at renderWithHooks (vendors.js:5386)
at mountIndeterminateComponent (vendors.js:5660)
at beginWork$1 (vendors.js:5962)
at Object.invokeGuardedCallbackImpl (vendors.js:6192)
at invokeGuardedCallback (vendors.js:6273)
at beginWork$$1 (vendors.js:6994)
at performUnitOfWork (vendors.js:6798)
at workLoopSync (vendors.js:6794)
at performSyncWorkOnRoot (vendors.js:6733)
import React, { Component, useEffect, useLayoutEffect, useReducer, useState, useContext, useRef, useCallback, useMemo, } from 'react'
import Taro, { Current, useRouter, useScope, useTabItemTap, useResize, useReachBottom, usePullDownRefresh, useDidHide, useDidShow, usePageScroll } from '@tarojs/taro'
// import { useSelector } from 'react-redux'
import { View, Image, Text, ScrollView } from '@tarojs/components'
import './index.less'
// type Definition
type OwnProps = {
};
export default function Index({ }: OwnProps) {
const scope = useScope() // 等同于页面为类时的 this.$scope
return (
<ScrollView
className='index__scrollview'
scrollWithAnimation
>
</ScrollView>
);
}
Current 模块可以正常引入和使用,但是开发工具会提示该模块没有被导出
提示如下
模块“"../../../../../../../Users/myAppnext/node_modules/_@[email protected]@@tarojs/taro/types"”没有导出的成员“Current”。ts(2305)
代码如下
import Taro, { Current } from '@tarojs/taro'
@WangShuXian6 目前 Typing 还没有跟上
引入taro-ui组件报错:
./node_modules/taro-ui/dist/weapp/index.js
Module not found: Can't resolve './style/index.scss' in '/Users/xxx/Downloads/my-taro/taro-form/node_modules/taro-ui/dist/weapp'
@wittech Taro UI 还没有发适配 Next 的版本
@yuche 请问预计什么时间发布适配版本呢?
@tarojs/taro-weapp
@tarojs/taro-tt
@tarojs/webpack-runner
@tarojs/taro-alipay
都没有3.0.0-alpha.2版呢
@ariesjia 这几个包不需要了
@wittech 这个你可以去 Taro UI 提 issue 问一下
@ariesjia 这几个包不需要了
谢谢,用next的cli init的的脚手架里面有这个几个包的依赖。
@ariesjia 哪个模板有
@yuche 刚才测试的是cloud
v3.0.0-alpha.3 的默认模板在 windows 下无法正常编译,似乎是由于对 windows 下的路径处理不正常,会将 \ 处理为字符转义
yarn run v1.19.1
$ npm run build:weapp -- --watch
> [email protected] build:weapp D:\TEMP_WORKSPACE\taro-react-hook-form
> npx taro build --type weapp "--watch"
�👽 Taro v3.0.0-alpha
开始编译项目 taro-react-hook-form
生成 工具配置 dist/project.config.json
\ 正在编译...[BABEL] Note: The code generator has deoptimised the styling of D:\TEMP_WORKSPACE\taro-react-hook-form\node_modules\react-reconciler\cjs\react-reconciler.development.js as it exceeds the max of 500KB.
�🙅 编译失败败.
./src/app.tsx
Module not found: Can't resolve 'D:TEMP_WORKSPACE aro-react-hook-formsrcapp.tsx' in 'D:\TEMP_WORKSPACE\taro-react-hook-form\src'
监听文件修改中...
@WangShuXian6 useScope 加了
@HareInWeed 你把 @tarojs/mini-runner 升级一下,确认 @tarojs/taro-loader 也是 alpha-3
@yuche 嘻嘻,我提的 #5475 canvas问题,有空帮我看一下呗。我现在就剩下这个问题就可以把小程序给发布了,虽然我自己改npm包也可以,但还是寻思你那边改一下。感谢。
今晚会发 alpha.4 带上这个 issue 的修复 @shenghanqin
taro 3 默认不需要 .eslintrc 文件了吗?
taro 3 默认不需要
.eslintrc文件了吗?
有的,现在改成了 .eslintrc.js
@yuche 我刚刚用 taro next 的 cli 创建了个 ts 项目,根目录没有 .eslintrc.js 所以就问了下
3-alpha3
在手动解决 taro-ui 的 scss 路径后可以编译成功,
但 taro-ui 会报如下错误:



3-alpha3
在手动解决 taro-ui 的 scss 路径后可以编译成功,
但 taro-ui 会报如下错误:
Taro UI 目前没有发布适配 Next 的版本,如果你实在想用,可以去 Taro UI 的 next 分支 src 目录复制一份代码到你的项目里,但这样的话你每次编译自己的项目的同时也要编译 Taro UI,会比较慢。
自定义 tabbar 的问题有解决的方法吗?
自定义 tabbar 的问题有解决的方法吗?
这个正在解决
配置文件config.js 有模板参考下吗


Styled Component 编译的 class 找不到,需要另外的特殊配置吗?
这里文档有误,Styled Component 是通过浏览器的 标签实现动态增删 css class 的,目前小程序的时候还没有很好的同类方案。我翻看了一下 issue 据说 emotion 支持直接静态编译 css,不过还得目前其它方面迭代完毕之后再去看了。
h5编译报错
创建 发现文件 src/pages/index/index.config.ts
TypeError: transformer_wx_1.default is not a function
at Compiler.processOthers (/usr/lib/node_modules/@tarojs/cli/dist/h5/index.js:759:43)
at Compiler.processFiles (/usr/lib/node_modules/@tarojs/cli/dist/h5/index.js:1240:39)
at Walker.<anonymous> (/usr/lib/node_modules/@tarojs/cli/dist/h5/index.js:125:30)
at Walker.emit (events.js:223:5)
at addChunk (_stream_readable.js:309:12)
at readableAddChunk (_stream_readable.js:290:11)
at Walker.Readable.push (_stream_readable.js:224:10)
at /usr/lib/node_modules/@tarojs/cli/node_modules/_klaw@2.1.1@klaw/src/index.js:32:19
at callback (/usr/lib/node_modules/@tarojs/cli/node_modules/_graceful-fs@4.2.3@graceful-fs/polyfills.js:295:20)
at FSReqCallback.oncomplete (fs.js:159:5)
创建 发现文件 src/pages/index/index.scss
创建 发现文件 src/pages/index/index.tsx
TypeError: transformer_wx_1.default is not a function
at Compiler.processOthers (/usr/lib/node_modules/@tarojs/cli/dist/h5/index.js:759:43)
at Compiler.processFiles (/usr/lib/node_modules/@tarojs/cli/dist/h5/index.js:1240:39)
at Walker.<anonymous> (/usr/lib/node_modules/@tarojs/cli/dist/h5/index.js:125:30)
at Walker.emit (events.js:223:5)
at addChunk (_stream_readable.js:309:12)
at readableAddChunk (_stream_readable.js:290:11)
at Walker.Readable.push (_stream_readable.js:224:10)
at /usr/lib/node_modules/@tarojs/cli/node_modules/_klaw@2.1.1@klaw/src/index.js:32:19
at callback (/usr/lib/node_modules/@tarojs/cli/node_modules/_graceful-fs@4.2.3@graceful-fs/polyfills.js:295:20)
at FSReqCallback.oncomplete (fs.js:159:5)
⠋ Compiling...(node:6336) UnhandledPromiseRejectionWarning: Error: spawn cmd.exe ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:81:21)
(node:6336) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6336) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
ℹ️ Listening at http://0.0.0.0:10086/
监听文件修改中...
🙅 Failed to compile.
multi (webpack)-dev-server/client?http://0.0.0.0:10086 (webpack)/hot/dev-server.js ./.temp/app.js
Module not found: Can't resolve '/mnt/d/me/code/code/javascript/test/taro-next3/taro-next3/.temp/app.js' in '/mnt/d/me/code/code/javascript/test/taro-next3/taro-next3'
环境
react + mobx + sass 模板
👽 Taro v3.0.0-alpha.4
Taro CLI 3.0.0-alpha.4 environment info:
System:
OS: Linux 4.4 Ubuntu 18.04.2 LTS (Bionic Beaver)
Shell: 3.0.2 - /usr/bin/fish
Binaries:
Node: 12.14.1 - /usr/bin/node
Yarn: 1.19.2 - /usr/local/bin/yarn
npm: 6.13.4 - /usr/bin/npm
npmPackages:
@tarojs/components: 3.0.0-alpha.4 => 3.0.0-alpha.4
@tarojs/taro: 3.0.0-alpha.4 => 3.0.0-alpha.4
@tarojs/webpack-runner: ^2.0.4 => 2.0.4
eslint-config-taro: 3.0.0-alpha.4 => 3.0.0-alpha.4
react: ^16.10.0 => 16.12.0
h5编译报错
创建 发现文件 src/pages/index/index.config.ts TypeError: transformer_wx_1.default is not a function at Compiler.processOthers (/usr/lib/node_modules/@tarojs/cli/dist/h5/index.js:759:43) at Compiler.processFiles (/usr/lib/node_modules/@tarojs/cli/dist/h5/index.js:1240:39) at Walker.<anonymous> (/usr/lib/node_modules/@tarojs/cli/dist/h5/index.js:125:30) at Walker.emit (events.js:223:5) at addChunk (_stream_readable.js:309:12) at readableAddChunk (_stream_readable.js:290:11) at Walker.Readable.push (_stream_readable.js:224:10) at /usr/lib/node_modules/@tarojs/cli/node_modules/_klaw@2.1.1@klaw/src/index.js:32:19 at callback (/usr/lib/node_modules/@tarojs/cli/node_modules/_graceful-fs@4.2.3@graceful-fs/polyfills.js:295:20) at FSReqCallback.oncomplete (fs.js:159:5) 创建 发现文件 src/pages/index/index.scss 创建 发现文件 src/pages/index/index.tsx TypeError: transformer_wx_1.default is not a function at Compiler.processOthers (/usr/lib/node_modules/@tarojs/cli/dist/h5/index.js:759:43) at Compiler.processFiles (/usr/lib/node_modules/@tarojs/cli/dist/h5/index.js:1240:39) at Walker.<anonymous> (/usr/lib/node_modules/@tarojs/cli/dist/h5/index.js:125:30) at Walker.emit (events.js:223:5) at addChunk (_stream_readable.js:309:12) at readableAddChunk (_stream_readable.js:290:11) at Walker.Readable.push (_stream_readable.js:224:10) at /usr/lib/node_modules/@tarojs/cli/node_modules/_klaw@2.1.1@klaw/src/index.js:32:19 at callback (/usr/lib/node_modules/@tarojs/cli/node_modules/_graceful-fs@4.2.3@graceful-fs/polyfills.js:295:20) at FSReqCallback.oncomplete (fs.js:159:5) ⠋ Compiling...(node:6336) UnhandledPromiseRejectionWarning: Error: spawn cmd.exe ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19) at onErrorNT (internal/child_process.js:456:16) at processTicksAndRejections (internal/process/task_queues.js:81:21) (node:6336) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:6336) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. ℹ️ Listening at http://0.0.0.0:10086/ 监听文件修改中... 🙅 Failed to compile. multi (webpack)-dev-server/client?http://0.0.0.0:10086 (webpack)/hot/dev-server.js ./.temp/app.js Module not found: Can't resolve '/mnt/d/me/code/code/javascript/test/taro-next3/taro-next3/.temp/app.js' in '/mnt/d/me/code/code/javascript/test/taro-next3/taro-next3'环境
react + mobx + sass 模板👽 Taro v3.0.0-alpha.4 Taro CLI 3.0.0-alpha.4 environment info: System: OS: Linux 4.4 Ubuntu 18.04.2 LTS (Bionic Beaver) Shell: 3.0.2 - /usr/bin/fish Binaries: Node: 12.14.1 - /usr/bin/node Yarn: 1.19.2 - /usr/local/bin/yarn npm: 6.13.4 - /usr/bin/npm npmPackages: @tarojs/components: 3.0.0-alpha.4 => 3.0.0-alpha.4 @tarojs/taro: 3.0.0-alpha.4 => 3.0.0-alpha.4 @tarojs/webpack-runner: ^2.0.4 => 2.0.4 eslint-config-taro: 3.0.0-alpha.4 => 3.0.0-alpha.4 react: ^16.10.0 => 16.12.0
alpha 版只支持小程序,beta 版将会支持 H5 端和移动端
不限制语言吗?python或c++应该是不可以吧。初步判断这是个描述错误
不限制语言吗?python或c++应该是不可以吧。初步判断这是个描述错误
c++ 应该可以,微信小程序可以通过 wasm 编译到 asm.js,python 没了解过,应该没有 wasm
taro3 alpha5 useShareAppMessage 没有效果, callback 没有执行.
以下 HACK 代码有效.
useEffect(() => {
Current.page.onShareAppMessage = () => { path: '', ... }
}, [])
@WangShuXian6 useScope 加了
你好,在3.0.0-alpha.5版本使用useScope,还是提示
Object(...) is not a function
TypeError: Object(...) is not a function
@WangShuXian6 useScope 加了
你好,在3.0.0-alpha.5版本使用useScope,还是提示
Object(...) is not a function TypeError: Object(...) is not a function
其实在 next 里已经没有 scope 这个概念了,useScope 返回的是一个 undefined
@WangShuXian6 useScope 加了
你好,在3.0.0-alpha.5版本使用useScope,还是提示
Object(...) is not a function TypeError: Object(...) is not a function其实在 next 里已经没有 scope 这个概念了,useScope 返回的是一个 undefined
这样的话,
Taro.createSelectorQuery().in()参数应该是什么呢?
目前尝试使用了Taro Element 实例对象和this,提示找不到正确的页面或组件
VM248:1 An SelectorQuery call is ignored because no proper page or component is found. Please considering usingSelectorQuery.into specify a proper one.
支付宝小程序 vue ready() 钩子不执行
👽 Taro v3.0.0-alpha.5
Taro CLI 3.0.0-alpha.5 environment info:
System:
OS: macOS High Sierra 10.13.6
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.11.1 - ~/.nvm/versions/node/v12.11.1/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.13.7 - ~/.nvm/versions/node/v12.11.1/bin/npm
npmPackages:
@tarojs/components: 3.0.0-alpha.5 => 3.0.0-alpha.5
@tarojs/taro: 3.0.0-alpha.5 => 3.0.0-alpha.5
eslint-config-taro: 3.0.0-alpha.5 => 3.0.0-alpha.5
支付宝小程序 vue ready() 钩子不执行
👽 Taro v3.0.0-alpha.5
Taro CLI 3.0.0-alpha.5 environment info:
System:
OS: macOS High Sierra 10.13.6
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.11.1 - ~/.nvm/versions/node/v12.11.1/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.13.7 - ~/.nvm/versions/node/v12.11.1/bin/npm
npmPackages:
@tarojs/components: 3.0.0-alpha.5 => 3.0.0-alpha.5
@tarojs/taro: 3.0.0-alpha.5 => 3.0.0-alpha.5
eslint-config-taro: 3.0.0-alpha.5 => 3.0.0-alpha.5
你的这几个字信息量太低了。
ready 是在什么样的组件,是页面是 app 还是普通组件,代码是怎么写的
支付宝小程序 vue ready() 钩子不执行
👽 Taro v3.0.0-alpha.5
Taro CLI 3.0.0-alpha.5 environment info:
System:
OS: macOS High Sierra 10.13.6
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.11.1 - ~/.nvm/versions/node/v12.11.1/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.13.7 - ~/.nvm/versions/node/v12.11.1/bin/npm
npmPackages:
@tarojs/components: 3.0.0-alpha.5 => 3.0.0-alpha.5
@tarojs/taro: 3.0.0-alpha.5 => 3.0.0-alpha.5
eslint-config-taro: 3.0.0-alpha.5 => 3.0.0-alpha.5你的这几个字信息量太低了。
ready 是在什么样的组件,是页面是 app 还是普通组件,代码是怎么写的
页面组件 page/index/index.vue:
<script>
import { mapGetters, mapActions } from 'vuex'
export default {
name: 'Index',
components: {
},
computed: {
...mapGetters(['userInfo'])
},
methods: {
...mapActions(['updateUserInfo'])
},
created () {
this.updateUserInfo()
console.log('created')
},
ready () {
console.log('ready')
},
beforeUpdate () {
console.log('beforeUpdate')
},
updated () {
console.log('updated')
},
beforeDestroy () {
console.log('beforeDestroy')
},
onShow () {
console.log('onShow')
},
onHide () {
console.log('onHide')
}
}
</script>

Taro v3.0.0-alpha.5
默认react redux模板,react-redux无法加载
➜ mahjong-next git:(master) ✗ yarn
yarn install v1.22.0
[1/4] 🔍 Resolving packages...
success Already up-to-date.
✨ Done in 2.02s.
➜ mahjong-next git:(master) ✗ npm run build:h5 -- --watch
mahjong-next@1.0.0 build:h5 /Users/Kamicloud/IdeaProjects/mahjong-next
taro build --type h5 "--watch"
👽 Taro v3.0.0-alpha.5
开始编译项目 mahjong-next
ℹ️ Listening at http://0.0.0.0:10086/
监听文件修改中...
🙅 Failed to compile.
./src/app.tsx 23:6
Module parse failed: Unexpected token (23:6)
You may need an appropriate loader to handle this file type.
| render () {
| return (
<Provider store={store}>| {this.props.children}
|
👽 Taro v3.0.0-alpha.5
看前面,h5 现在还跑不了
@yuche 你好,旧项目有部分组件使用到Taro.createSelectorQuery().in(this.$scope) ,现在next取消了scope,请问需要怎么调用createSelectorQuery().in()
@yuche 你好,旧项目有部分组件使用到Taro.createSelectorQuery().in(this.$scope) ,现在next取消了scope,请问需要怎么调用createSelectorQuery().in()
https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html
直接这样用,没有 in
@yuche
button组件type属性为default,button按钮背景为白色,background-color不生效
移除type属性后background-color生效


移除type属性后background-color生效
也就是说 button 的 type 其实默认不是 default?
移除type属性后background-color生效
也就是说 button 的 type 其实默认不是 default?
看小程序button组件介绍,type默认值是default,default对应的是白底黑字
在注释掉@tarojs/shared包下components.ts下button的type属性后,就正常了
看小程序button组件介绍,type默认值是default,default对应的是白底黑字
如果注释掉的话,再写 type 就不会有效果了。编译器也是从 @tarojs/shared/components 拿数据的
看小程序button组件介绍,type默认值是default,default对应的是白底黑字
如果注释掉的话,再写 type 就不会有效果了。编译器也是从 @tarojs/shared/components 拿数据的
@yuche 2.0版本button未指定type,编译后也不带type
next版本button未指定type, 编译后带type="default"
从 2.0 升级过来时也遇到了这个问题,修改 CSS 选择器权重 .bg-blue[type='default']
从 2.0 升级过来时也遇到了这个问题,修改 CSS 选择器权重
.bg-blue[type='default']
Thanks♪(・ω・)ノ
@yuche


clbutton组件被comp组件包裹,导致样式失效。
@yuche
他可以先看看 comp 组件里面的元素的事件有没有效,如果无效应该是编译出了问题,可以去提一个 issue。
临时的解决方案是找到 config/index.js 其中 mini.baseLevel 设置为 30 或更高可以避免生成这个组件,但这样你的 base.wxml 就会变大。
next版本没有convert功能了吗
next版本没有convert功能了吗
Taro next 现在还没有适配 convert 功能,准备下周适配
使用Nerv跑h5和微信小程序报错,是我姿势不对吗




使用Nerv跑h5和微信小程序报错,是我姿势不对吗
上面不知道说了多少次了现在还不支持 h5,你用 nerv 就要去看文档里 nerv 的说明啊,把 react 和 react-dom alias 到 nervjs,不然你又用 nerv 又用 react 吗
@yuche
他可以先看看 comp 组件里面的元素的事件有没有效,如果无效应该是编译出了问题,可以去提一个 issue。
临时的解决方案是找到
config/index.js其中mini.baseLevel设置为 30 或更高可以避免生成这个组件,但这样你的 base.wxml 就会变大。
设置成30可以了,Thanks♪(・ω・)ノ
临时的解决方案是找到
config/index.js其中mini.baseLevel设置为 30 或更高可以避免生成这个组件,但这样你的 base.wxml 就会变大。
麻烦帮忙看一下不设置时事件是否有效,如果无效可以去提一个 issue
麻烦帮忙看一下不设置时事件是否有效,如果无效可以去提一个 issue
我试了事件是有效的,只是因为comp组件导致样式无效
Map 组件 onRegionChange 事件无效


swiper 再滑动后 swiper-item 部分属性丢失
仓库地址: https://github.com/lihuaye/mp-colorui
复现步骤: 视图->Calendar 日历
swiper-item
具体是哪个属性?
具体是哪个属性?
swiper-item的style属性,在没滑动之前是有的
3.0.0目前无法编译UI组件(TARO_BUILD_TYPE=ui)么?
👽 Taro v3.0.0-alpha.5
Taro CLI 3.0.0-alpha.5 environment info:
System:
OS: macOS 10.15.3
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 13.8.0 - /var/folders/66/9_9tp95d2396hxgd8b2w4nj40000gn/T/yarn--1583218525433-0.9343660526039685/node
Yarn: 1.22.0 - /var/folders/66/9_9tp95d2396hxgd8b2w4nj40000gn/T/yarn--1583218525433-0.9343660526039685/yarn
npm: 6.13.7 - /usr/local/bin/npm
npmPackages:
@tarojs/cli: 3.0.0-alpha.5 => 3.0.0-alpha.5
@tarojs/components: 3.0.0-alpha.5 => 3.0.0-alpha.5
@tarojs/taro: 3.0.0-alpha.5 => 3.0.0-alpha.5
@tarojs/webpack-runner: ^2.0.5 => 2.0.5
eslint-config-taro: 3.0.0-alpha.5 => 3.0.0-alpha.5
react: ^16.10.0 => 16.13.0
npmGlobalPackages:
typescript: 3.7.4
✨ Done in 4.70s.
有计划支持composition-api么, 有这个可能么。 https://github.com/vuejs/composition-api
3.0.0目前无法编译UI组件(TARO_BUILD_TYPE=ui)么?
👽 Taro v3.0.0-alpha.5 Taro CLI 3.0.0-alpha.5 environment info: System: OS: macOS 10.15.3 Shell: 5.7.1 - /bin/zsh Binaries: Node: 13.8.0 - /var/folders/66/9_9tp95d2396hxgd8b2w4nj40000gn/T/yarn--1583218525433-0.9343660526039685/node Yarn: 1.22.0 - /var/folders/66/9_9tp95d2396hxgd8b2w4nj40000gn/T/yarn--1583218525433-0.9343660526039685/yarn npm: 6.13.7 - /usr/local/bin/npm npmPackages: @tarojs/cli: 3.0.0-alpha.5 => 3.0.0-alpha.5 @tarojs/components: 3.0.0-alpha.5 => 3.0.0-alpha.5 @tarojs/taro: 3.0.0-alpha.5 => 3.0.0-alpha.5 @tarojs/webpack-runner: ^2.0.5 => 2.0.5 eslint-config-taro: 3.0.0-alpha.5 => 3.0.0-alpha.5 react: ^16.10.0 => 16.13.0 npmGlobalPackages: typescript: 3.7.4 ✨ Done in 4.70s.
这个的确也还不支持。但 taro next 之后,UI 组件可以像编译普通 h5 组件那样编译,你可以把他发布的 NPM 上,只要最终引用这些组件的时候是使用 taro cli 编译就行。
目前你可以使用这个库编译,只要一条命令即可:
https://github.com/developit/microbundle
有计划支持composition-api么, 有这个可能么。 https://github.com/vuejs/composition-api
你可以直接用来试试,只要使用组件时一定是通过 .vue 文件就行。如果有问题就去提 issue。
非常感谢!
试用3.0由于是使用React,这个issue中的问题是否就迎刃而解了。
是否有考虑将这个问题在2.X中修复呢?死等!
非常感谢!
试用3.0由于是使用React,这个issue中的问题是否就迎刃而解了。
是否有考虑将这个问题在2.X中修复呢?死等!
taro next 还没有 h5 支持,估计未来 1 到 2 个版本就可以试用了。
👽 Taro v3.0.0-alpha.5
开始编译项目 taro
警告 依赖安装 项目依赖 @tarojs/taro-swan 未安装,或安装有误!
(node:21400) UnhandledPromiseRejectionWarning: Error: Missing binding D:web-testtaronode_modulesnode-sassvendorwin32-x64-72binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js
12.x
👽 Taro v3.0.0-alpha.5
开始编译项目 taro
警告 依赖安装 项目依赖 @tarojs/taro-swan 未安装,或安装有误!
(node:21400) UnhandledPromiseRejectionWarning: Error: Missing binding D:web-testtaronode_modulesnode-sassvendorwin32-x64-72binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js
12.x
你应该没更新 @tarojs/mini-runner
👽 Taro v3.0.0-alpha.5
开始编译项目 taro
警告 依赖安装 项目依赖 @tarojs/taro-swan 未安装,或安装有误!
(node:21400) UnhandledPromiseRejectionWarning: Error: Missing binding D:web-testtaronode_modulesnode-sassvendorwin32-x64-72binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js
12.x你应该没更新 @tarojs/mini-runner
更新了的 版本号都是3.0.0-alpha.5
初始化项目失败
? 请输入项目介绍! test
? 请选择框架 React
? 是否需要使用 TypeScript ? Yes
? 请选择 CSS 预处理器(Sass/Less/Stylus) Sass
? 请选择模板 redux
SyntaxError: Error parsing /usr/local/lib/node_modules/@tarojs/cli/templates/redux/package.json: Unexpected token < in JSON at position 183
at parse (<anonymous>)
at readPackage (internal/modules/cjs/loader.js:256:20)
at readPackageScope (internal/modules/cjs/loader.js:281:19)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1162:17)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1040:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/usr/local/lib/node_modules/@tarojs/cli/dist/create/init.js:151:54)
at Generator.next (<anonymous>) {
path: '/usr/local/lib/node_modules/@tarojs/cli/templates/redux/package.json'
}
node v13.8.0
npm 6.14.1
这个在2.0.4里面是已经修复了,但是在next版本里面貌似没有作对应的修改
init最简单的hello word 编译成头条小程序 在头条开发者工具里报错,微信小程序模式没有问题
init最简单的hello word 编译成头条小程序 在头条开发者工具里报错,微信小程序模式没有问题
报错吗
v3.0.0-alpha.3 的默认模板在 windows 下无法正常编译,似乎是由于对 windows 下的路径处理不正常,会将
\处理为字符转义yarn run v1.19.1 $ npm run build:weapp -- --watch > taro-react-hook-form@1.0.0 build:weapp D:\TEMP_WORKSPACE\taro-react-hook-form > npx taro build --type weapp "--watch" �👽 Taro v3.0.0-alpha 开始编译项目 taro-react-hook-form 生成 工具配置 dist/project.config.json \ 正在编译...[BABEL] Note: The code generator has deoptimised the styling of D:\TEMP_WORKSPACE\taro-react-hook-form\node_modules\react-reconciler\cjs\react-reconciler.development.js as it exceeds the max of 500KB. �🙅 编译失败败. ./src/app.tsx Module not found: Can't resolve 'D:TEMP_WORKSPACE aro-react-hook-formsrcapp.tsx' in 'D:\TEMP_WORKSPACE\taro-react-hook-form\src' 监听文件修改中...
同样的问题,老哥你解决了吗?
�🙅 编译失败败.
升级到 alpha.5 就行了
�🙅 编译失败败.
升级到 alpha.5 就行了
可是已经是 alpha.5 了
�🙅 编译失败败.
升级到 alpha.5 就行了
可是已经是 alpha.5 了
删除了重装
�🙅 编译失败败.
升级到 alpha.5 就行了
可是已经是 alpha.5 了删除了重装
老哥,还是不行

�🙅 编译失败败.
升级到 alpha.5 就行了
可是已经是 alpha.5 了删除了重装
老哥,还是不行
你看一下 node_modules/@tarojs/taro-loader 的版本是不是对不上
�🙅 编译失败败.
升级到 alpha.5 就行了
可是已经是 alpha.5 了删除了重装
老哥,还是不行
你看一下 node_modules/@tarojs/taro-loader 的版本是不是对不上
是 alpha.5 啊
�🙅 编译失败败.
升级到 alpha.5 就行了
可是已经是 alpha.5 了删除了重装
老哥,还是不行
你看一下 node_modules/@tarojs/taro-loader 的版本是不是对不上
是 alpha.5 啊
mini-runner 的 node_modules 里面有没有 @tarojs/taro-loader?
�🙅 编译失败败.
升级到 alpha.5 就行了
可是已经是 alpha.5 了删除了重装
老哥,还是不行
你看一下 node_modules/@tarojs/taro-loader 的版本是不是对不上
是 alpha.5 啊
mini-runner 的 node_modules 里面有没有 @tarojs/taro-loader?
没有

�🙅 编译失败败.
升级到 alpha.5 就行了
可是已经是 alpha.5 了删除了重装
老哥,还是不行
你看一下 node_modules/@tarojs/taro-loader 的版本是不是对不上
是 alpha.5 啊
mini-runner 的 node_modules 里面有没有 @tarojs/taro-loader?
没有
编译 React 会有路径问题吗
�🙅 编译失败败.
升级到 alpha.5 就行了
可是已经是 alpha.5 了删除了重装
老哥,还是不行
你看一下 node_modules/@tarojs/taro-loader 的版本是不是对不上
是 alpha.5 啊
mini-runner 的 node_modules 里面有没有 @tarojs/taro-loader?
没有
编译 React 会有路径问题吗
不会,react项目正常
@yuche 比起vue项目,react项目中的 mini-runner 的 node_modules 下多了好多文件夹,包括@tarojs/taro-loader
init最简单的hello word 编译成头条小程序 在头条开发者工具里报错,微信小程序模式没有问题
报错吗
编译报错
环境信息
Taro CLI 3.0.0-alpha.5 environment info:
System:
OS: macOS 10.14.5
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.18.0 - ~/.nvm/versions/node/v10.18.0/bin/node
npm: 6.13.4 - ~/.nvm/versions/node/v10.18.0/bin/npm
npmPackages:
@tarojs/components: 3.0.0-alpha.5 => 3.0.0-alpha.5
@tarojs/taro: 3.0.0-alpha.5 => 3.0.0-alpha.5
eslint-config-taro: 3.0.0-alpha.5 => 3.0.0-alpha.5
react: ^16.10.0 => 16.13.0
使用 useReachBottom 时,声明的 state 变量总是为初始值,如下示例
import React from 'react';
import Taro from '@tarojs/taro';
import { View, Text, Button } from '@tarojs/components';
export default function Example() {
const [count, setCount] = React.useState(0);
Taro.useReachBottom(() => {
// count 输出总是为 0
console.log(count);
});
return (
<View style={{ height: '200vh' }}>
<Text>You clicked {count} times</Text>
<Button onClick={() => setCount(count + 1)}>Click me</Button>
</View>
);
}
使用
useReachBottom时,声明的 state 变量总是为初始值,如下示例import React from 'react'; import Taro from '@tarojs/taro'; import { View, Text, Button } from '@tarojs/components'; export default function Example() { const [count, setCount] = React.useState(0); Taro.useReachBottom(() => { // count 输出总是为 0 console.log(count); }); return ( <View style={{ height: '200vh' }}> <Text>You clicked {count} times</Text> <Button onClick={() => setCount(count + 1)}>Click me</Button> </View> ); }
这是闭包的问题,你可以通过类似 setCount(c => console.log(c)) 避免 useReactBottom 的闭包访问之前的 count 属性。
在 useReachBottom 中如何获取声明的 state hook 的值
import React from 'react';
import { useReachBottom } from '@tarojs/taro';
import { View, Text, Button } from '@tarojs/components';
export default function Example() {
const [count, setCount] = React.useState(0);
useReachBottom(() => {
// count 输出总是为 0
if (count > 10) {
return;
}
setCount(c => c + 1);
});
return (
<View style={{ height: '200vh' }}>
<Text>You clicked {count} times</Text>
<Button onClick={() => setCount(c => count + 1)}>Click me</Button>
</View>
);
}
// count 输出总是为 0
那我再说详细点:
这不是一个 Taro 问题,也不是 React Hooks 的问题,而是 JavaScript 闭包机制的问题。
当你声明了 count 这个变量时,useReachBottom 作为一个闭包函数会捕捉上下文变量,这时候它拿到的count 就是当 count 被声明时候的值。你把 useReachBottom 换成 setTimeout 之类的函数也是一样的效果。
根据你的业务逻辑不同,解决这个问题的方法也有各种不同的手段,我之前提到的通过 setCount 传递一个函数是一种方法,直接用 useRef 也是一种方法,用 useCallback 再写一个避免闭包的函数也是一种方法,开一个新变量存起来也是一种方法,你对 JavaScript 了解得越多方法就越多。对大部分情况而言 useRef 就够了。
按照 useRef 修改,多谢指导🙏
import React from 'react';
import Taro from '@tarojs/taro';
import { View, Text, Button } from '@tarojs/components';
export default function Example() {
const [count, setCount] = React.useState(0);
const ref = React.useRef();
ref.current = () => {
if (count > 10) {
return;
}
setCount(count + 1);
};
Taro.useReachBottom(() => {
ref.current();
});
return (
<View style={{ height: '200vh' }}>
<Text>You clicked {count} times</Text>
<Button onClick={() => setCount(c => count + 1)}>Click me</Button>
</View>
);
}
按照 useRef 修改,不知道理解是否正确,多谢指导🙏
import React from 'react'; import Taro from '@tarojs/taro'; import { View, Text, Button } from '@tarojs/components'; export default function Example() { const [count, setCount] = React.useState(0); const ref = React.useRef(); function callback() { if (count > 10) { return; } setCount(count + 1); } React.useEffect(() => { ref.current = callback; }); Taro.useReachBottom(() => { ref.current(); }); return ( <View style={{ height: '200vh' }}> <Text>You clicked {count} times</Text> <Button onClick={() => setCount(c => count + 1)}>Click me</Button> </View> ); }
你写得太复杂了,这样就可以:
export default function Example() {
const [count, setCount] = React.useState(0);
const countRef = React.useRef(null)
countRef.current = count
Taro.useReachBottom(() => {
// countRef.current 就是 count 的最新值
console.log(countRef.current)
});
return (
<View style={{ height: '200vh' }}>
<Text>You clicked {count} times</Text>
<Button onClick={() => setCount(count + 1)}>Click me</Button>
</View>
);
}
页面引用组件打包后,组件样式丢失,在编译预览模式下正常
补充:组件样式是在组件中引入的,目前只能将组件样式提升到入口文件处
alpha.7

alpha.7
- 初始化脚手架 发现缺少 @tarojs/webpack-runner@next包, 手动安装之
- 运行dev:h5时无法正常启动
alpha 版本没有 h5 支持
alpha.7
- 初始化脚手架 发现缺少 @tarojs/webpack-runner@next包, 手动安装之
- 运行dev:h5时无法正常启动
alpha 版本没有 h5 支持
麻烦问一下, 有支持计划吗? , 我们正在在调研框架, H5是其中的一个因素
alpha.7
- 初始化脚手架 发现缺少 @tarojs/webpack-runner@next包, 手动安装之
- 运行dev:h5时无法正常启动
alpha 版本没有 h5 支持
麻烦问一下, 有支持计划吗? , 我们正在在调研框架, H5是其中的一个因素
这几天就会发布 beta 版本,会带上 h5 支持
到 alpha9了还不支持H5么
问一下, next 是否支持混写呢? 页面维度的 还是 组件维度的
的
混写有两个方面:
对于情况 1,组件维度我们不推荐混写,因为只要你引入了 Taro Next 的一个组件,就要引入 Taro 的所有依赖,并且 Taro Next 目前也没有做出接口可以让原生小程序调用。页面维度可以混写,但是目录编排要根据你项目的特性具体讨论,但此情况页面混写的话 Taro 页面之间是不可通信的,如果以后我们有业务需求可能会拖充这方面的支持。
对于情况 2,如果是使用原生组件目前已经支持,如果是使用原生小程序页面也不难,只要把原生小程序页面的代码复制到 taro 编译后的目录就行了。
另外一点值得注意的是,一旦开启了混写,这个应用只能运行在小程序端。
鸡冻人心,期待正式版
@yuche beta.0支持h5了吗?
@yuche beta.0支持h5了吗?
支持了,一楼已经说得很清楚了
@yuche beta.0版本, React报告缺少react-dom
🙅 Failed to compile.
./node_modules/@tarojs/runtime/dist/runtime.esm.js
Module not found: Can't resolve 'react-dom' in '/Users/hanqin/nodeworks/goddess-hat/quickly-mask-react/taro/node_modules/@tarojs/runtime/dist''
@yuche beta.0版本, React报告缺少react-dom
🙅 Failed to compile. ./node_modules/@tarojs/runtime/dist/runtime.esm.js Module not found: Can't resolve 'react-dom' in '/Users/hanqin/nodeworks/goddess-hat/quickly-mask-react/taro/node_modules/@tarojs/runtime/dist''
装一个就好了
@yuche 有报错
index.js?c00c:54 Uncaught TypeError: Cannot read property 'designWidth' of undefined
at Object.pxTransform (index.js?c00c:54)
at TaroCropperComponent.render (index.tsx?8f0a:529)
at finishClassComponent
/**
* RouterParams
*
* @typedef {Object} RouterParams
* @property {string} path 小程序切前台的路径
* @property {number} scene 小程序切前台的场景值
* @property {Object} query 小程序切前台的 query 参数
* @property {string} shareTicket shareTicket,详见获取更多转发信息
* @property {Object} referrerInfo 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 {}。(参见后文注意)
*/
const pxTransform = function (size) {
const { designWidth } = taro.config
return Math.ceil((((parseInt(size, 10) / 40) * 640) / designWidth) * 10000) / 10000 + 'rem'
}
@yuche 有报错
index.js?c00c:54 Uncaught TypeError: Cannot read property 'designWidth' of undefined at Object.pxTransform (index.js?c00c:54) at TaroCropperComponent.render (index.tsx?8f0a:529) at finishClassComponent /** * RouterParams * * @typedef {Object} RouterParams * @property {string} path 小程序切前台的路径 * @property {number} scene 小程序切前台的场景值 * @property {Object} query 小程序切前台的 query 参数 * @property {string} shareTicket shareTicket,详见获取更多转发信息 * @property {Object} referrerInfo 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 {}。(参见后文注意) */ const pxTransform = function (size) { const { designWidth } = taro.config return Math.ceil((((parseInt(size, 10) / 40) * 640) / designWidth) * 10000) / 10000 + 'rem' }
TaroCropperComponent 是从哪来的
// 这是我用到的地方,源码:https://raw.githubusercontent.com/shenghanqin/quickly-mask/feature/next-react-20200213/taro/src/components/taro-cropper/index.tsx
const finishStyle: CSSProperties = {
position: 'absolute',
display: 'inline-block',
color: themeColor,
textAlign: "right",
fontSize: Taro.pxTransform(32),
bottom: Taro.pxTransform(30),
right: Taro.pxTransform(30),
};

在某些配置下,无法使用taro create命令创建页面

使用taro init新建项目,选择vuex-sass-ts,之后在项目里taro create --name xx创建页面,会提示创建成功,但是实际上目录里并没有这个文件夹,也没有吧页面路径加到json里面。
如果选择vue-sass-noneTS配置,则可以正常新建页面,我大概测试了一下,好像在模板选项中选择vuex就无法正常新建

以及,是不是应该在添加页面后自动添加到app.config.js文件中pages字段下

@yuche 3.0.0-beta.0 新建项目,vue+ts+sass,webpack-runner,编译h5,依然存在“Module not found: Can't resolve 'C:Usereepgit arosrcapp'”拼字符串错误的问题
@yuche 3.0.0-beta.0 新建项目,vue+ts+sass,webpack-runner,编译h5,依然存在“Module not found: Can't resolve 'C:Usereepgit arosrcapp'”拼字符串错误的问题
我也遇到了这个问题,我记得alpha3编译小程序有过类似的vue端的问题
3.0.0-beta.0 新建项目, react+js+sass, yarn dev:h5可以实时编译,但是hot-reload无法刷新,看 devtool websocket 收到了更新的消息,不过 ui 上没有变化。 @yuche
从alpha .5 升到 beta 出错了
Entry module not found: Error: Can't resolve '/Users/origami/Desktop/indigo/indigo-mp/src/pages/Feed/builder/index.config' in '/Users/origami/Desktop/indigo/indigo-mp/src'
这是我的文件结构

@yuche
3.0.0-beta.0 新建项目, react+js+sass,
yarn dev:h5可以实时编译,但是hot-reload无法刷新,看 devtool websocket 收到了更新的消息,不过 ui 上没有变化。 @yuche
这个你提个 issue 吧,不然等下忘了
3.0.0-beta.1 新建项目
sitemap.json
Error: 未找到入口 sitemap.json 文件,或者文件读取失败,请检查后重新编译。
在项目根目录创建 sitemap.json。构建项目不会在dist目录下生成。
错误提示仍在。
3.0.0-beta.1 的 vue 模板。按照文档的多端组件编写,写成 component.vue component.h5.vue 之后,h5的组件没有生效,依然使用的是 component.vue 的版本
3.0.0-beta.2 百度智能小程序报错跑不起来
- 新建项目选择react 和typescript
- yarn dev:swan
看起来是百度小程序进行了一次非兼容升级:
https://smartprogram.baidu.com/forum/topic/show/74605
影响 Taro next 的部分是 requestAnimationFrame 不能用了
3.0.0-beta.2 百度智能小程序报错跑不起来
- 新建项目选择react 和typescript
- yarn dev:swan
看起来是百度小程序进行了一次非兼容升级:
https://smartprogram.baidu.com/forum/topic/show/74605影响 Taro next 的部分是 requestAnimationFrame 不能用了
使用vue构建swan 百度智能小程序,webpack构建阶段就失败了

3.0.0-beta.2 百度智能小程序报错跑不起来
- 新建项目选择react 和typescript
- yarn dev:swan
看起来是百度小程序进行了一次非兼容升级:
smartprogram.baidu.com/forum/topic/show/74605
影响 Taro next 的部分是 requestAnimationFrame 不能用了使用vue构建swan 百度智能小程序,webpack构建阶段就失败了
这个报错我开了几个项目试了都无法复现,你 init 选了哪些选项
taro init, 选择 vue, js, sassabout, 一个组件baseButtonindex 和 about页面同时引用baseButton component baseButton这个 Vue SFC中如果有style, 构建swan 失败, 如果没有style, 构建swan是正常的附上代码:
taro-beta2-test.zip
@eiddie 下个版本修复,可以先不加 --watch
@eiddie 下个版本修复,可以先不加
--watch
beta3 版本swan 在--watch的时候能正常了,但是又引入了新的问题,所有小程序构建在--watch模式下,修改内容终端直接异常崩掉
--watch模式下更改内容会异常崩掉taro init, 选择 vue, js, sassabout, 一个组件baseButtonindex 和 about页面同时引用baseButton component baseButton这个 Vue SFC中如果有style, webpack构建会异常, 如果没有style, --watch正常的
附上代码:
taro-beta3-vue.zip
@eiddie 下个版本再试试 https://github.com/NervJS/taro/commit/deb8a9f3bc198f32c5f797e6bdbec410397d7e16
🙅 Failed to compileVue SFC中只要有style并且lang="scss"就会出现h5构建失败
@tarojs/components 中的组件样式会被默认的weui样式覆盖掉<Button className='btn-custom'>custom button</Button>
.btn-custom {
color: red;
}
h5 components渲染结果:
<taro-button-core class="btn-custom hydrated">
<button
class="weui-btn taro-button weui-btn_default"
type="default">
custombutton
</button>
</taro-button-core>
自定义的className都会作用在外层div上,修改样式始终会被weui全局样式覆盖掉
下面这种方式虽然能够暂时修改h5 components样式,但是开发体验上不能和小程序保持一致性
.btn-custom {
.taro-button {
color: red;
}
}
@yuche 为何不提供一个关闭weui-btn的设置选项呢?
@eiddie 下个版本再试试 deb8a9f
5926
这次提交,小程序--watch异常退出的问题解决了,:+1:
@yuche 为何不提供一个关闭weui-btn的设置选项呢?
weui 整个样式在stencil构建web components时直接注入全局,他怎么对每个component提供相应的设置选项关闭weui,这改的肯定不是一点点
https://github.com/NervJS/taro/blob/deb8a9f3bc198f32c5f797e6bdbec410397d7e16/packages/taro-components/stencil.config.ts#L7
beta版本更新日志在哪啊?
@eiddie Button 样式问题下个版本再试试。
Stencil 使用 WebComponent 会多了一层 Host 标签,而 button 组件内部一定要有一个 button 标签是因为 weui 使用了 button 选择器。这两者共同导致了这个问题。
目前是在每次 WebComponent render 后,把 Host 上的 class 和 style 都复制到 button 标签上,暂时应该能解决问题。
另外 Stencil 注入的全局样式 globalStyle: './node_modules/weui/dist/style/weui.css', 应该是在 header 中较用户的 css 之前插入的,这样当权重一样时自定义样式应该能覆盖 weui 样式。
配置修改:

报错信息

@eiddie Button 样式问题下个版本再试试。
5956ec7 还是有点问题,width又被weui覆盖掉了,还有就是对于@tarojs/components中的其他组件也是可能存在用户样式被组件内部样式或者weui 样式覆盖掉的问题
这样当权重一样时自定义样式应该能覆盖 weui 样式。
这个前提是权重一样,但很多时候用户写的样式的权重并不是大于等于组件内部样式或weui样式的权重,
比如用户样式.btn-custom 和weui样式button.weui-btn, 后者的权重要比前者高,很明显用户样式又被组件内部样式或者weui覆盖掉了
从开发体验上看,希望小程序上的样式能够同样适用于h5,不需要做任何更改,目前@tarojs/components好像还是不能做到这一点
beta版本更新日志在哪啊?
@fred8617 https://github.com/NervJS/taro/releases
想知道 3.0下 source-map对接sentry方案是否可行
hash模式没生效h5: {
router: {
mode: 'hash'
}
}
router配置hashmode效果确是browsermode效果
taro next beta3 构建h5
🙅 Failed to compilerepro
- taro init, 选择 vue, js, sass
- 任意一个
Vue SFC中只要有style并且lang="scss"就会出现h5构建失败
想请问一下,你提的这个问题你解决了吗,怎么解决的?
- taro init, 选择 vue, js, sass
下个版本这个应该就修复了
- taro init, 选择 vue, js, sass
下个版本这个应该就修复了
beta4 这个问题仍然存在
beta4 更新日志中
修复 watch 模式 Vue SFC 无法使用 style 标签的问题
问题条件是:Vue SFC 中有style且lang=”scss“两个条件
@eiddie
比如用户样式.btn-custom 和weui样式button.weui-btn, 后者的权重要比前者高,很明显用户样式又被组件内部样式或者weui覆盖掉了
这点其实你用原生小程序也一样的,button[plain] 一样比用户的 .btn-custom 重。

现在 button 的样式剥离了 weui,使用了标签名选择器设置基础样式,起码基础样式上用户能通过一个类名进行覆盖。
@Chen-jj
简单的一个Button,都是用默认属性来自定义Button样式
<Button className='btn-custom'>
custom button
</Button>
.btn-custom {
color: red;
width: 200px;
}
小程序效果:

h5效果:

0b647998 提交后小程序效果不变,h5效果还是有问题:

@eiddie button 剥离 weui 后 width 的设置不会被内置样式覆盖了。其它涉及属性选择器的内置样式还是要注意。
@eiddie button 剥离 weui 后 width 的设置不会被内置样式覆盖了。其它涉及属性选择器的内置样式还是要注意。
为什么小程序button 默认属性,用户样式color和width都生效,但是button 剥离 weui 后color又被覆盖掉了
taro next beta3 构建h5
🙅 Failed to compilerepro
- taro init, 选择 vue, js, sass
- 任意一个
Vue SFC中只要有style并且lang="scss"就会出现h5构建失败
想请问一下,你提的这个问题你解决了吗,怎么解决的?
beta 5 修复
taro next beta3 构建h5
🙅 Failed to compilerepro
- taro init, 选择 vue, js, sass
- 任意一个
Vue SFC中只要有style并且lang="scss"就会出现h5构建失败
想请问一下,你提的这个问题你解决了吗,怎么解决的?
beta 5 修复
@Chen-jj
还是有点问题
43aa63c 提交前报错条件是: Vue SFC中有style且lang=scss, 但是lang=sass是正常的
43aa63c 提交后: Vue SFC中有style且lang=sass会报错, 但是lang=scss是正常的
taro next beta3 h5 默认模板,开启css module报错
配置修改:
报错信息
@windego beta 5 修复
3.0.0-beta.3
用nerv编译小程序 报错"Nerv is not defined".
不引入'@tarojs/components' 组件就不会报错
@kangyana beta 5 修复
typescript 还不行?
@yuche beta.5 的 typescript 定义文件有点问题,npm 上的和 repo上面的不一致。


但repo上这里其实是定义了的 https://github.com/NervJS/taro/blob/c81a1d5ba6754aa0eda103a4a9dbe9f03b55dade/packages/taro/types/api/base/debug.d.ts#L124
9b24f46 这个 commit 在 beta.5 发布之前,但是安装下来的 npm 包却没有 commit 里面的内容
@yuche beta.5 的 typescript 定义文件有点问题,npm 上的和 repo上面的不一致。
但repo上这里其实是定义了的
9b24f46 这个 commit 在 beta.5 发布之前,但是安装下来的 npm 包却没有 commit 里面的内容
未能复现到该问题,可以检查下项目内的 ts 配置是否正确。
@ZakaryCode


这是我安装的 taro beta.5, node_modules 里面没有 getRealtimeLogManager 的定义
@ZakaryCode
这是我安装的 taro beta.5, node_modules 里面没有
getRealtimeLogManager的定义
你安装的不是 beta.5,仔细看版本的 id
@yuche 是依赖哪里有问题吗

@dpyzo0o 写死 3.0.0-beta.5,前面不要加 ^,不要会跳到 3.0.0-experimental.5
@dpyzo0o 写死 3.0.0-beta.5,前面不要加 ^,不要会跳到 3.0.0-experimental.5
解决了,谢谢
next 版本已经是运行时了么? @yuche
可以投入生产使用了吗。。

@Thyiad 体验一下。。。我觉得还有坑
beta6
出现大量警告
onflicting order between:
* css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/server-image/styles.scss
* css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/elements/styles.scss
* css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/listof/styles.scss
* css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/form/field/styles.scss
WARNING in chunk common [mini-css-extract-plugin]
Conflicting order between:
* css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/navigation/styles.scss
* css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/elements/ele-card/styles.scss
* css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/elements/ele-card/status-flag.scss
* css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/elements/styles.scss
WARNING in chunk common [mini-css-extract-plugin]
Conflicting order between:
* css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/section-bar/styles.scss
* css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/elements/ele-card/styles.scss
* css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/elements/ele-card/status-flag.scss
* css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/elements/styles.scss
@kala888 怎样复现?
@Chen-jj https://github.com/kala888/nice-router-taro.git 切换到branch:taro3,启动就报warning
@kala888 https://github.com/webpack-contrib/mini-css-extract-plugin/issues/250#issuecomment-415345126
自己调一下 import 顺序吧,大概意思是 mini-css-extract-plugin 需要按引用顺序去生成 css 文件,如果多个文件引入顺序不一就会警告。
有没有朋友遇到 安卓手机,百度小程序,从浏览器点进去 会闪几下屏的问题?
3.0.0-beta.6
Vue 是不是还不能引用 import { View } from '@tarojs/components'
初始模板用的 view 标签 是可以的
3.0.0-beta.6
Vue 是不是还不能引用 import { View } from '@tarojs/components'
初始模板用的 view 标签 是可以的
什么样的情况下你要在 Vue 中 import { View } from '@tarojs/components'
3.0.0-beta.6
Vue 是不是还不能引用 import { View } from '@tarojs/components'
初始模板用的 view 标签 是可以的什么样的情况下你要在 Vue 中
import { View } from '@tarojs/components'
我是想着从 '@tarojs/components' 引用的内置组件应该会具有更好的兼容性
而且内置组件都是用 stencil 重写,还以为是可以 react 和 vue 共用呢?
或者说以后有没有支持的共用可能性?
我是想着从 '@tarojs/components' 引用的内置组件应该会具有更好的兼容性
在 vue 里面你直接用字符串 view, scroll-view 就行了,不需要引入。React 和 Vue 的确公用一套公有的 stencil 组件,但他们都分别包了一层 wrapper
beta6
出现大量警告onflicting order between: * css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/server-image/styles.scss * css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/elements/styles.scss * css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/listof/styles.scss * css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/form/field/styles.scss WARNING in chunk common [mini-css-extract-plugin] Conflicting order between: * css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/navigation/styles.scss * css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/elements/ele-card/styles.scss * css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/elements/ele-card/status-flag.scss * css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/elements/styles.scss WARNING in chunk common [mini-css-extract-plugin] Conflicting order between: * css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/section-bar/styles.scss * css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/elements/ele-card/styles.scss * css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/elements/ele-card/status-flag.scss * css ./node_modules/@tarojs/mini-runner/node_modules/css-loader/dist/cjs.js??ref--4-oneOf-0-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/dist/cjs.js??ref--4-oneOf-0-3!./src/components/elements/styles.scss
@kala888 我也遇到了,这是 mini-css-extract-plugin 的原因,他项目的 issue 里也有人提出里这个问题,但是有些情况下是不需要检验样式文件的导入顺序的,比如,我使用了 css module。所以,mini-css-extract-plugin 在 v0.8 加入了一个插件参数,用以忽略该警告:
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
plugins: [
new MiniCssExtractPlugin({
ignoreOrder: true,
}),
],
// ...
};
对应于这儿的配置文件,就是在 mini 或者 h5 块中添加
const config = {
mini: {
enableExtract: true,
miniCssExtractPluginOption: {
ignoreOrder: true,
},
},
// ...
}
然后我发现并不能生效,后来我查了一下 Taro 的依赖,发现:
这儿依赖的版本还不支持 ignoreOrder 设置,这需要 Taro 更新一下 @Chen-jj ,我目前是把生成的 yarn.lock 文件中的依赖版本改了一下,暂时能用。
在 vue 里面你直接用字符串
view,scroll-view就行了,不需要引入。React 和 Vue 的确公用一套公有的 stencil 组件,但他们都分别包了一层 wrapper
好的呢,感谢大佬
什么时候可以开发第三方多端 UI 库啊 build --ui
"@tarojs/taro-h5": "3.0.0-beta.6",
H5的两个bug

切换到branch taro3-bug-test
- Taro.navigateTo等路由函数,没有then了。
调用方法错误了,不能直接传字符串
taro-router
before:
Taro.navigateTo('/page/me/me-page').then(...)
after:
Taro.navigateTo({url: '/page/me/me-page'}).then(...)
@psaren 不要意思,示例代码写错了,但是问题是存在的,已更新代码
@yuche 这俩链接挂了
文档:
https://taro-docs.jd.com/taro/next/docs/README.html旧版本迁移指南:
https://taro-docs.jd.com/taro/next/docs/migration.html
@ziruozimi 文档升级后,对文档做了一些调整,你要找的应该是这两个吧
https://taro-docs.jd.com/taro/docs/3.0.0-beta.5/README
https://taro-docs.jd.com/taro/docs/3.0.0-beta.5/migration
@ziruozimi 文档升级后,对文档做了一些调整,你要找的应该是这两个吧
https://taro-docs.jd.com/taro/docs/3.0.0-beta.5/README
https://taro-docs.jd.com/taro/docs/3.0.0-beta.5/migration
对的,感谢😀
@baixiaosh 新开一个 issue 吧,最好附上可复现的 demo。
@Chen-jj 不好意思,已经找到问题了
transitionend没有处理
@ziruozimi 新开一个 issue 吧,把问题说清楚。
app.tsx 中这种写法
class App extends React.Component {
render() {
return <View className='app_wrapper'>{this.props.children}</View>
}
}
为啥这个class为 app_wrapper 的View都不渲染呢?@yuche
rc.4 版本。 微信小程序环境
虚拟列表 不支持动态高度吗?
感觉小程序生成的base.wxml有点大,刚迁移没几个页面,已经到550多K了,
生成了15份tmpl_*_component模板,这个是根据页面最多使用组件数生成的么?

rc.5 版本中发现View组件的hidden属性无效了哦
希望支持svg
感觉小程序生成的base.wxml有点大,刚迁移没几个页面,已经到550多K了,
生成了15份tmpl_*_component模板,这个是根据页面最多使用组件数生成的么?
我只是写了几个组件就过了500K了
体积真的太大了,我只写了三个组件和一个页面,预览模式下就超了 2 M。
这是 dev 下的:

这是 prod 下的:

官方文档中有 useReady 的介绍:https://nervjs.github.io/taro/docs/next/hooks/#useready
但是使用的时候:
import { useReady } from '@tarojs/taro';
提示:模块“"../../../node_modules/@tarojs/taro/types"”没有导出的成员“useReady”。
给我报错plugins.0 "plugins[0]" must be one of [string, array]
怎么处理的呢
@potatoes0521 目前 v3.0.2,没遇到问题。是不是配置的位置写错了?或者看一下根目录的 babel.config.js plugins 配置对不对。我能想到的就这两个原因了。

缺少 app 全局配置,请检查! 各位打了这个如何解决。
缺少 app 全局配置,请检查! 各位打了这个如何解决。
src下新建app.config.js
使用 taro 3.5 开发百度只能小程序,出现‘计时器组件’更新自身数据时,导致这个页面重新渲染问题;计时器每秒执行一次,页面就会自动创建一个 页面根元素,及其所有子元素;

rc.5 版本中发现View组件的hidden属性无效了哦
我这边也是,你是怎么解决的呢
rc.5 版本中发现View组件的hidden属性无效了哦
我这边也是,你是怎么解决的呢
不要用 hidden 属性,用 React、Vue 的语法去控制显隐
rc.5 版本中发现View组件的hidden属性无效了哦
我这边也是,你是怎么解决的呢
不要用 hidden 属性,用 React、Vue 的语法去控制显隐
从小程序源码转码过来的项目,之前是taro1(v1.3.21),现在在做升级taro3(v3.0.17,react)发现hidden不支持了,一个一个修改比较麻烦,有无可能 提供babel插件转一下hidden语法再webpack打包?或者在babel-preset-taro做一下支持呀? 另外taro3转小程序源码后的代码也包含hidden。
rc.5 版本中发现View组件的hidden属性无效了哦
我这边也是,你是怎么解决的呢
不要用 hidden 属性,用 React、Vue 的语法去控制显隐
你说的用语法控制显示隐藏是什么意思? 是类似 flag ? <View1> : <View2/>, 这样的吗?这个样子会导致微信小程序的内存占用过高, 而导致闪退.
rc.5 版本中发现View组件的hidden属性无效了哦
我这边也是,你是怎么解决的呢
不要用 hidden 属性,用 React、Vue 的语法去控制显隐
从小程序源码转码过来的项目,之前是taro1(v1.3.21),现在在做升级taro3(v3.0.17,react)发现hidden不支持了,一个一个修改比较麻烦,有无可能 提供babel插件转一下hidden语法再webpack打包?或者在babel-preset-taro做一下支持呀? 另外taro3转小程序源码后的代码也包含hidden。
你好, 你的问题解决了吗?
rc.5 版本中发现View组件的hidden属性无效了哦
我这边也是,你是怎么解决的呢
不要用 hidden 属性,用 React、Vue 的语法去控制显隐
从小程序源码转码过来的项目,之前是taro1(v1.3.21),现在在做升级taro3(v3.0.17,react)发现hidden不支持了,一个一个修改比较麻烦,有无可能 提供babel插件转一下hidden语法再webpack打包?或者在babel-preset-taro做一下支持呀? 另外taro3转小程序源码后的代码也包含hidden。
你好, 你的问题解决了吗?
我也想知道这个问题该怎么优雅的解决,不会要挨个手动
display: none吧!
rc.5 版本中发现View组件的hidden属性无效了哦
我这边也是,你是怎么解决的呢
不要用 hidden 属性,用 React、Vue 的语法去控制显隐
从小程序源码转码过来的项目,之前是taro1(v1.3.21),现在在做升级taro3(v3.0.17,react)发现hidden不支持了,一个一个修改比较麻烦,有无可能 提供babel插件转一下hidden语法再webpack打包?或者在babel-preset-taro做一下支持呀? 另外taro3转小程序源码后的代码也包含hidden。
你好, 你的问题解决了吗?
我也想知道这个问题该怎么优雅的解决,不会要挨个手动
display: none吧!
<View> 组件不支持 hidden 属性,使用 React、Vue 的条件渲染或样式去处理。hidden 属性的功能,在 3.1 已经支持。
Most helpful comment
beta6
出现大量警告