Giter Site home page Giter Site logo

taro-sample-weapp's Introduction

taro-sample-weapp

说明

Taro 与小程序原生融合的示例项目,包括:

  • wxParse 示例
  • echarts-for-weixin 示例
  • 混写原生页面示例

安装与运行

首先需要全局安装 cli 开发工具 @tarojs/cli

$ npm i -g @tarojs/cli
$ yarn global add @tarojs/cli

然后执行如下命令,运行完后打开微信开发者工具,选择项目根目录进行预览

$ taro build --type weapp --watch

taro-sample-weapp's People

Contributors

chen-jj avatar luckyadam avatar yuche avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

taro-sample-weapp's Issues

运行报错Expect FLOW_CREATE_NODE but get another

taro v3.0.0-beta.3 运行失败

taro build --type weapp --watch编译成功后,微信小程序编辑器控制台报错,taro doctor有很多错误,小程序控制到报错如下:
thirdScriptError
_taroWeapp2.default.RefsArray is not a constructor
TypeError: _taroWeapp2.default.RefsArray is not a constructor
at Index._constructor (http://127.0.0.1:21089/appservice/pages/index/index.js:81:21)
at Object.createComponent (http://127.0.0.1:21089/appservice/taro.js:1955:55)
at Object.3 (http://127.0.0.1:21089/appservice/pages/index/index.js:158:42)
at webpack_require (http://127.0.0.1:21089/appservice/runtime.js:80:30)
at Module.10 (http://127.0.0.1:21089/appservice/pages/index/index.js:8:172)
at webpack_require (http://127.0.0.1:21089/appservice/runtime.js:80:30)
at Module.32 (http://127.0.0.1:21089/appservice/pages/index/index.js:168:96)
at webpack_require (http://127.0.0.1:21089/appservice/runtime.js:80:30)
at checkDeferredModules (http://127.0.0.1:21089/appservice/runtime.js:46:23)
at Array.webpackJsonpCallback [as push] (http://127.0.0.1:21089/appservice/runtime.js:33:19)

Page "pages/index/index" has not been registered yet.

无法运行

TypeError: (0 , _index.genCompid) is not a function

如果使用antv-f2图形库,使用方法是否同echart一样?

我仿照echart的写法,出现这样的问题。
组件需绑定 opts 变量,例:
<ff-canvas` id="mychart-dom-bar" canvas-id="mychart-bar" opts="{{ opts }}">

state = { opts : { onInit: initChart } } render () { return ( <View className='container'> <ff-canvas id="bar-dom" canvas-id="bar" opts="{{ this.state.opts }}" /> </View> ) }

动态pages配置

当前的需求是同一个app先混编历史微信小程序代码和新写的taro代码
这样的话就需要在不同的目标平台中有不同的pages配置
目前app.json中的pages是通过ast静态分析app.js中的config得到的,不支持这样的目的。
建议:
app.js中支持多平台特定配置,可以和默认配置做merge

运行后echarts图没有画出来

VM7002:1 TypeError: _this.data.ec.onInit is not a function
at t. (http://127.0.0.1:61504/appservice/components/ec-canvas/ec-canvas.js:68:39)
at http://127.0.0.1:61504/appservice/__dev__/WAService.js:10:5997
at Array.forEach ()
at http://127.0.0.1:61504/appservice/__dev__/WAService.js:10:5945
at http://127.0.0.1:61504/appservice/__dev__/WAService.js:10:4023
at e.(anonymous function) (http://127.0.0.1:61504/appservice/__dev__/WAService.js:4:5071)
at e (http://127.0.0.1:61504/appservice/appservice?t=1537178738885:4835:19952)
at r.registerCallback.t (http://127.0.0.1:61504/appservice/appservice?t=1537178738885:4835:20137)
at l.forEach.t (http://127.0.0.1:61504/appservice/appservice?t=1537178738885:4835:1538)
at Array.forEach ()
console.error @ VM7002:1
l.forEach.t @ appservice?t=1537178738885:4835
(anonymous) @ appservice?t=1537178738885:4835
i.onmessage @ appservice?t=1537178738885:4835

如何把组件树(componentsTree)中的某children组件设置为根组件,从而渲染在大纲树顶端和画布最外部容器。。。

image
image
步骤:
1、打开宜搭表单设计器,随便拖入表单元素
2、打开隐藏的schema面板查看schema 数据结构
3、发现用户设计的真实数据是包裹在 Page -> RootContent -> FormContainer -> children中
4、得出结论:大纲树中的顶端组件和画布最外层容器都是 FormContainer 组件 ,而低代码引擎demo中渲染的根节点是Page组件
期望:
1、基于低代码引擎和demo,实现如宜搭的表单设计器结构。即:可以将children中的组件渲染在大纲树顶端,成为画布最外层容器

在app.tsx设置usingComponents,一直报错Component is not found in path

把loading动画的效果,做成了一个公共组件,因为每个页面都会用,所以想要全局引入。
在app.tsx设置usingComponents,一直报错Component is not found in path "component/loadingcom"

代码如下:
usingComponents:{
"loadingcom":"../../component/loadingcom"
}
下面两种都试过了,都不行
"loadingcom":"/component/loadingcom"
"loadingcom":"component/loadingcom"
请教正确的写法是什么?

注:不是小程序原生组件,就是Taro的写法,写了一个显示和隐藏loading图片的组件,在src下面的component文件夹下,和pages文件夹是同级

无法加载wxParse.wxss文件

只要我使用第三方文件,所有第三方的标签全都报错 版本1.0.0-beta.26
image
而且你这个demo我运行不起来
image

npm run dev:rn 报错: [BABEL] Note: The code generator has deoptimised the styling of "unknown" as it exceeds the max of "500KB".

缺少npm包babel-plugin-transform-jsx-to-stylesheet,开始安装...
(node:26065) UnhandledPromiseRejectionWarning: RangeError: Maximum call stack size exceeded
    at write (console.js:165:9)
    at Console.log (console.js:197:3)
    at resolveNpmSync (/usr/local/lib/node_modules/@tarojs/cli/src/util/npm.js:41:15)
    at resolveNpmSync (/usr/local/lib/node_modules/@tarojs/cli/src/util/npm.js:47:14)
    at resolveNpmSync (/usr/local/lib/node_modules/@tarojs/cli/src/util/npm.js:47:14)
    at resolveNpmSync (/usr/local/lib/node_modules/@tarojs/cli/src/util/npm.js:47:14)
    at resolveNpmSync (/usr/local/lib/node_modules/@tarojs/cli/src/util/npm.js:47:14)
    at resolveNpmSync (/usr/local/lib/node_modules/@tarojs/cli/src/util/npm.js:47:14)
    at resolveNpmSync (/usr/local/lib/node_modules/@tarojs/cli/src/util/npm.js:47:14)
    at resolveNpmSync (/usr/local/lib/node_modules/@tarojs/cli/src/util/npm.js:47:14)
(node:26065) 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:26065) [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.

我把babel-plugin-transform-jsx-to-stylesheet加到安装后, 就报这个错误:

开始编译项目 taro-sample-weapp
编译  JS        /Users/apple/Downloads/taro-sample-weapp-master/src/app.js
编译  SCSS      /Users/apple/Downloads/taro-sample-weapp-master/src/app.scss
编译  JS        /Users/apple/Downloads/taro-sample-weapp-master/src/utils/util.js
编译  JS        /Users/apple/Downloads/taro-sample-weapp-master/src/components/ec-canvas/ec-canvas.js
编译  JS        /Users/apple/Downloads/taro-sample-weapp-master/src/components/ec-canvas/echarts.js
[BABEL] Note: The code generator has deoptimised the styling of "unknown" as it exceeds the max of "500KB".
(node:26311) UnhandledPromiseRejectionWarning: TypeError: Property consequent of ConditionalExpression expected node to be of a type ["Expression"] but instead got null
    at Object.validate (/usr/local/lib/node_modules/@tarojs/cli/node_modules/babel-types/lib/definitions/index.js:109:13)
    at Object.validate (/usr/local/lib/node_modules/@tarojs/cli/node_modules/babel-types/lib/index.js:505:9)
    at NodePath._replaceWith (/usr/local/lib/node_modules/@tarojs/cli/node_modules/babel-traverse/lib/path/replacement.js:176:7)
    at NodePath._remove (/usr/local/lib/node_modules/@tarojs/cli/node_modules/babel-traverse/lib/path/removal.js:58:10)
    at NodePath.remove (/usr/local/lib/node_modules/@tarojs/cli/node_modules/babel-traverse/lib/path/removal.js:30:8)
    at CallExpression (/usr/local/lib/node_modules/@tarojs/cli/src/rn.js:388:25)
    at NodePath._call (/usr/local/lib/node_modules/@tarojs/cli/node_modules/babel-traverse/lib/path/context.js:76:18)
    at NodePath.call (/usr/local/lib/node_modules/@tarojs/cli/node_modules/babel-traverse/lib/path/context.js:48:17)
    at NodePath.visit (/usr/local/lib/node_modules/@tarojs/cli/node_modules/babel-traverse/lib/path/context.js:105:12)
    at TraversalContext.visitQueue (/usr/local/lib/node_modules/@tarojs/cli/node_modules/babel-traverse/lib/context.js:150:16)
(node:26311) 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:26311) [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.

Taro3 首页点击按钮跳转到 echarts 示例出错

首页能正常展示,可一旦跳转到echarts 示例就出错
image
image

VM100 WAService.js:2 TypeError: t.addEventListener is not a function at ui (VM107 common.js:15) at xi.<anonymous> (VM107 common.js:15) at Array.forEach (<anonymous>) at d (VM107 common.js:15) at e (VM107 common.js:15) at new xi (VM107 common.js:15) at new xw (VM107 common.js:15) at _i (VM107 common.js:15) at new Vr (VM107 common.js:15) at Object.t.init (VM107 common.js:15)(env: Windows,mp,1.05.2109131; lib: 2.20.2)

compile fail

Taro Version 2.2.4
errorInfo: 找不到项目配置文件config/index,请确定当前目录是 Taro 项目根目录!
but directory is OK

输入命令编译失败

D:\taro-sample-weapp>taro build --type weapp --watch
� Taro v1.3.30

开始编译项目 taro-sample-weapp
(node:11276) UnhandledPromiseRejectionWarning: RangeError: Maximum call stack size exceeded
at Object.normalize (path.js:279:32)
at Object.join (path.js:483:18)
at readPackageJSON (C:\Users\hr\AppData\Roaming\npm\node_modules@tarojs\cli\node_modules\find-yarn-workspace-root\index.js:48:21)
at findWorkspaceRoot (C:\Users\hr\AppData\Roaming\npm\node_modules@tarojs\cli\node_modules\find-yarn-workspace-root\index.js:23:22)
at recursiveFindNodeModules (C:\Users\hr\AppData\Roaming\npm\node_modules@tarojs\cli\dist\util\index.js:456:27)
at recursiveFindNodeModules (C:\Users\hr\AppData\Roaming\npm\node_modules@tarojs\cli\dist\util\index.js:461:12)
at recursiveFindNodeModules (C:\Users\hr\AppData\Roaming\npm\node_modules@tarojs\cli\dist\util\index.js:461:12)
at recursiveFindNodeModules (C:\Users\hr\AppData\Roaming\npm\node_modules@tarojs\cli\dist\util\index.js:461:12)
at recursiveFindNodeModules (C:\Users\hr\AppData\Roaming\npm\node_modules@tarojs\cli\dist\util\index.js:461:12)
at recursiveFindNodeModules (C:\Users\hr\AppData\Roaming\npm\node_modules@tarojs\cli\dist\util\index.js:461:12)
(node:11276) 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(). (re
jection id: 1)
(node:11276) [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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.