123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- // pages/my/index.js
- const app = getApp()
- import Dialog from '../../miniprogram_npm/vant-weapp/dialog/dialog';
- import * as echarts from '../../ec-canvas/echarts';
- // let chart = null;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- // nvabarData: {
- // showCapsule: 0, //是否显示左上角图标,消息中心 1表示显示 0表示不显示
- // showBack: 1, //返回
- // title: '我的', //导航栏 中间的标题
- // // 此页面 页面内容距最顶部的距离
- // height: app.globalData.height * 2 + 20,
- // },
- active: 4,
- CustomBar: app.globalData.CustomBar, // 注意 这是侧边抽底计算的适配距离 basis-xl 左测弹出的宽度
- ColorList: app.globalData.ColorList,
- searchValue: '',
- show: false,
- modalName: null,
- ec: {
- lazyLoad: true
- },
- },
- changeSearch() {
- console.log(this.data.searchValue);
- },
- onChange(e) {
- this.setData({
- searchValue: e.detail,
- });
- },
- //点击弹出层
- clickPop() {
- this.setData({
- show: true,
- });
- },
- onClose() {
- this.setData({
- show: false,
- });
- },
- clickdialog() {
- Dialog.confirm({
- title: '标题',
- message: '弹窗内容',
- }).then(() => {
- // on close
- });
- },
- showModal(e) {
- console.log(e)
- this.setData({
- modalName: e.currentTarget.dataset.target
- })
- },
- hideModal(e) {
- this.setData({
- modalName: null
- })
- },
- getOption() {
- console.log("我是初始化的charts")
- var option = {
- title: {
- text: 'ECharts 入门示例'
- },
- tooltip: {},
- xAxis: {
- data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
- },
- yAxis: {},
- series: [{
- name: '销量',
- type: 'bar',
- data: [5, 20, 36, 10, 10, 20]
- }]
- }
- return option;
- },
- /**
- * 生命周期函数--监听页面加载
- */
- init_echarts: function () {
- this.echartsComponnet.init((canvas, width, height) => {
- // 初始化图表
- const Chart = echarts.init(canvas, null, {
- width: width,
- height: height
- });
- Chart.setOption(this.getOption());
- // 注意这里一定要返回 chart 实例,否则会影响事件处理等
- return Chart;
- });
- },
- onLoad: function (options) {
- this.echartsComponnet = this.selectComponent('#mychart');
- this.init_echarts()
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- // setTimeout(this.getData, 5000);
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- wx.showNavigationBarLoading() //在标题栏中显示加载
- wx.showLoading({
- title: '正在刷新数据',
- })
- setTimeout(function () {
- wx.hideLoading();
- }, 2000);
- wx.stopPullDownRefresh();
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|