-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Taro 中引入 Parse 渲染报错 ./base.wxml Template tmpl_5_parser
not found.
#7550
Comments
能否给个 demo 看下 |
遇到同样的问题,按照官方文档引入echarts-for-weixin,提示 WXMLRT_$gwx:./base.wxml:template:425:16: Template
|
我和楼上遇到一样的问题,请问怎么处理 |
我也遇到了,你解决了吗 |
试试在 config/index.js 文件中添加 config.copy.patterns 复制组件到目标文件夹。
例如:
copy: {
patterns: [
{ from: 'src/sitemap.json', to: 'dist/sitemap.json' },
{ from: 'src/utils/libs/parser/', to: 'dist/utils/libs/parser/' }
],
options: {
}
},
在 2020-12-22 17:43:37,"jinqh" <notifications@github.com> 写道:
遇到同样的问题,按照官方文档引入echarts-for-weixin,提示 WXMLRT_$gwx:./base.wxml:template:425:16: Template tmpl_0_ec-canvas not found.
参考链接:https://github.com/NervJS/taro-sample-weapp/blob/master/src/pages/echarts/echarts.js
"@tarojs/cli": "3.0.9"
demo
// page/echarts/echarts.tsx
import React from 'react';
import { View } from '@tarojs/components'
import * as echarts from '../../components/ec-canvas/echarts'
import styles from './index.module.scss';
function initChart(canvas, width, height) {
const chart = echarts.init(canvas, null, {
width: width,
height: height
})
canvas.setChart(chart)
const model = {
yCates: ['Saturday', 'Friday', 'Thursday',
'Wednesday', 'Tuesday', 'Monday',
'Sunday'],
xCates: ['1', '2', '3', '4', '5'],
data: [
// [yCateIndex, xCateIndex, value]
[0, 0, 5], [0, 1, 7], [0, 2, 3], [0, 3, 5], [0, 4, 2],
[1, 0, 1], [1, 1, 2], [1, 2, 4], [1, 3, 8], [1, 4, 2],
[2, 0, 2], [2, 1, 3], [2, 2, 8], [2, 3, 6], [2, 4, 7],
[3, 0, 3], [3, 1, 7], [3, 2, 5], [3, 3, 1], [3, 4, 6],
[4, 0, 3], [4, 1, 2], [4, 2, 7], [4, 3, 8], [4, 4, 9],
[5, 0, 2], [5, 1, 2], [5, 2, 3], [5, 3, 4], [5, 4, 7],
[6, 0, 6], [6, 1, 5], [6, 2, 3], [6, 3, 1], [6, 4, 2]
]
}
const data = model.data.map(function (item) {
return [item[1], item[0], item[2] || '-']
})
const option = {
tooltip: {
position: 'top'
},
animation: false,
grid: {
bottom: 60,
top: 10,
left: 80
},
xAxis: {
type: 'category',
data: model.xCates
},
yAxis: {
type: 'category',
data: model.yCates
},
visualMap: {
min: 1,
max: 10,
show: false,
calculable: true,
orient: 'horizontal',
left: 'center',
bottom: 10,
inRange: {
color: ['#37A2DA', '#32C5E9', '#67E0E3', '#91F2DE', '#FFDB5C', '#FF9F7F'],
}
},
series: [{
name: 'Punch Card',
type: 'heatmap',
data: data,
label: {
normal: {
show: true
}
},
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}]
}
chart.setOption(option)
return chart
}
export default class Echarts extends React.Component {
constructor(props){
super(props)
}
config = {
navigationBarTitleText: 'echarts-for-weixin 示例项目',
navigationBarTextStyle: 'black',
// navigationBarTitleText: 'WxParse 使用示例',
backgroundColor: '#eeeeee',
backgroundTextStyle: 'light',
usingComponents: {
'ec-canvas': '../../components/ec-canvas/ec-canvas' // 书写第三方组件的相对路径
}
}
state = {
ec: {
onInit: initChart
}
}
render () {
return (
<View className={styles.echarts}>
<ec-canvas id='mychart-dom-area' canvas-id='mychart-area' ec={this.state.ec}></ec-canvas>
</View>
)
}
}
我也遇到了,你解决了吗
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Vue2 应该参考 vue 分支:https://github.com/NervJS/taro-sample-weapp/tree/vue |
usingComponents 的 alias 当时没有支持,最新版本应该没有问题了。 |
相关平台
京东小程序
小程序基础库: 2.10.4
使用框架: React
复现步骤
1、组件引入
config = {
usingComponents: {
parser: '@/utils/Parser/index' // 引入插件包
}
}
2、render () {
return (
)
}
期望结果
渲染富文本
实际结果
VM1098:1 ./base.wxml
Template
tmpl_5_parser
not found.2115 |
2116 |
The text was updated successfully, but these errors were encountered: