详细操作
在 mpvue 使用 echarts 小程序组件。。。。下载echarts-for-weixin。。。。
把其ec-canvas目录移动到 mpvue 项目的static目录下。。。。
对ec-canvas/ec-canvas.js举行小调解,,,,思量提 pr 到 ec-canvas。。。。
修改 ready 为异步获取数据。。。。
ready: function () {
// 异步获取
setTimeout(() => {
if (!this.data.ec) {
console.warn('组件需绑定 ec 变量,,,,例:');
return;
}
if (!this.data.ec.lazyLoad) {
this.init();
}
}, 10)
}
为 init 添加吸收 options 传参
var query = wx.createSelectorQuery().in(this);
query.select('.ec-canvas').boundingClientRect(res => {
if (typeof callback === 'function') {
this.chart = callback(canvas, res.width, res.height);
}
else if (this.data.ec && this.data.ec.onInit) {
this.chart = this.data.ec.onInit(canvas, res.width, res.height);
}
else if (this.data.ec && this.data.ec.options) {
// 添加吸收 options 传参
const ec = this.data.ec
function initChart(canvas, width, height) {
const chart = echarts.init(canvas, null, {
width: width,
height: height
});
canvas.setChart(chart);
chart.setOption(ec.options);
return chart;
}
this.chart = initChart(canvas, res.width, res.height);
}
}).exec();
建设pages/bar页面,,,,目录如下:
.
└── pages
└── bar
├── index.vue
└── main.js
在 main.js 中引入微信小程序的自界说组件
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
// 添加 config json
export default {
config: {
// 这儿添加要用的小程序组件
usingComponents: {
'ec-canvas': '../../../static/ec-canvas/ec-canvas'
}
}
}
在 app.vue 中添加 options、template 等相关设置
Build Setup
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
KESION 金狮贵宾会软件
KESION 金狮贵宾会软件是海内领先的在线教育软件及私域社交电商软件服务提供商,,,,恒久专注于为企业提供在线教育软件及社交电商SaaS平台解决方案。。。。
公司焦点产品云开店SaaS社交电商服务平台、在线教育SaaS服务平台、教育企业数字化SaaS云平台、企微营销助手、私有化自力安排品牌网校和在线教育咨询等。。。。KESION 一直通过手艺立异,,,,提供产品和服务,,,,助力企业向数字化转型,,,,通过科技驱动商业刷新,,,,让商业变得更智慧!
微信小程序直播订阅提醒功效组件如下,,,,用户进入直播间内,,,,可对一场未开播的直播举行单次订阅,,,,开播时直播组件会自动下发开播提醒给用户。。。。 【订阅】组件(注:若要使用该组件,,,,...
React转微信小程序:从React类界说到Component挪用 。。。。这是本系列的第二篇,,,,已往两周,,,,已经有相当效果出来。。。。本文介绍其中一部分可靠的思绪,,,,这个比京东的taro更具可靠性。。。。若是以为看不过瘾.