当前位置: 首页 > news >正文

加盟网站制作费用小程序搭建挣钱

加盟网站制作费用,小程序搭建挣钱,有没有什么做地堆的网站,广州优秀网站设计使用的uniapp插件:l-echart https://ext.dcloud.net.cn/plugin?id4899 注意事项 1.因为小程序有主包分包大小限制#xff0c;并且uni_modules中的包也会算在主包体积中#xff0c;而我项目中的图表是在分包中使用的#xff0c;所以我移动uni_modules中的l-echart图表组件…使用的uniapp插件:l-echart https://ext.dcloud.net.cn/plugin?id4899 注意事项 1.因为小程序有主包分包大小限制并且uni_modules中的包也会算在主包体积中而我项目中的图表是在分包中使用的所以我移动uni_modules中的l-echart图表组件到分包目录组件文件夹中 2.精简echarts.min.js体积因为需求中只需要柱图和饼图所以我去https://echarts.apache.org/zh/builder.html下载指定的 echarts 组件压缩包然后替换l-echart中的echarts.min.js文件只需要500kb左右大小 页面中的用法 templateview classcharts-boxl-echart refchart finishedinit classcharts-box/l-echart/view /templatescript import LEchart from /package-pc/pages/components/lime-echart/components/l-echart/l-echart.vue; import * as echarts from /package-pc/pages/components/lime-echart/static/echarts.min.js; import option from /package-pc/pages/monthreport/option; export default {components: {LEchart,},data() {return {option: option,};},// 使用组件的finished事件里调用methods: {async init() {const chart await this.$refs.chart.init(echarts);chart.setOption(this.option);},}, }; /scriptstyle scoped /* 请根据实际需求修改父元素尺寸组件自动识别宽高 */ .charts-box {width: 100%;height: 600px; } /style第一次尝试修改l-echart源码简化组件用法不推荐用法 这样写有一个重大问题uniapp不支持props传递的对象里面属性有function而echarts这样的属性很多所以不推荐这样修改源码这里只是记录一下我尝试封装的思路过程 1.组件中直接引入echarts.min.js 2.props增加option传参 3.watch中监听option传参 4.mounted中直接执行init方法初始化图表 5.init方法中调用setOption方法 6.加入uni.onWindowResize方法监听宽高变化然后调用原本就实现的resize方法 import * as echarts from /package-pc/pages/components/lime-echart/static/echarts.min.js; export default {name: lime-echart,props: {...option: {type: Object,},},watch: {option: {handler() {this.setOption(this.option);},deep: true,},},mounted() {this.$nextTick(() {this.$emit(finished);this.init();});},methods:{...async init(...args) {// #ifndef APP-NVUE// if (arguments arguments.length 1) {// console.error(// 缺少参数init(echarts, theme?:string, opts?: object, callback?: function)// );// return;// }// #endif...this.chart echarts.init(config.canvas,theme,Object.assign({}, config, opts));this.chart.setOption(this.option ?? {});uni.onWindowResize(() {this.resize();});...},}修改后的页面用法 直接传参option给组件请求接口后修改option即可 templateview classcharts-boxl-echart :optionoption1 classcharts-box/l-echart/view /templatescript import LEchart from /package-pc/pages/components/lime-echart/components/l-echart/l-echart.vue; import option from /package-pc/pages/monthreport/option; export default {components: {LEchart,},data() {return {option: option,};},// 修改option即可methods: {async setText() {this.option.title.text test},}, }; /scriptstyle scoped /* 请根据实际需求修改父元素尺寸组件自动识别宽高 */ .charts-box {width: 100%;height: 600px; } /style第二次尝试修改l-echart源码简化组件用法推荐用法 做的工作其实就是把echarts放在组件里面使用了页面中就不用导入了同时组件内部做了init初始化图表页面中setOption就行了 import * as echarts from /package-pc/pages/components/lime-echart/static/echarts.min.js; export default {name: lime-echart,mounted() {this.$nextTick(async () {await this.init();this.$emit(finished);});},methods:{...async init(...args) {// #ifndef APP-NVUE// if (arguments arguments.length 1) {// console.error(// 缺少参数init(echarts, theme?:string, opts?: object, callback?: function)// );// return;// }// #endif...this.chart echarts.init(config.canvas,theme,Object.assign({}, config, opts));uni.onWindowResize(() {this.resize();});...},}修改后的页面用法 templateview classcharts-boxl-echartrefchart:optionoptionfinishedinitclasscharts-box/l-echart/view /templatescript import LEchart from /package-pc/pages/components/lime-echart/components/l-echart/l-echart.vue; import option from /package-pc/pages/monthreport/option; export default {components: {LEchart,},data() {return {option: option,};},// finished回调中设置option接口请求图表数据也放在这里methods: {init() {this.$refs.chart.setOption(this.option);},}, }; /scriptstyle scoped /* 请根据实际需求修改父元素尺寸组件自动识别宽高 */ .charts-box {width: 100%;height: 600px; } /style
http://www.pierceye.com/news/987597/

相关文章:

  • 大连优化网站怎样制作企业的网站
  • 网站建设邀请函北京网站优化 卓立海创
  • 公司后台的网站代理维护更新商贸有限公司注销流程
  • 网站建设工作动态wordpress次元主题
  • 手机网站源码asp网站快速排名技巧
  • 站点怎么建网页宁波网站建设设计制作公司
  • 黑龙江企业网站建设网站模板带后台 下载
  • 徐州在线制作网站营销网络是什么意思
  • 上海网站建设seo公司微信小程序制作教学
  • 信息化工作总结 网站建设十堰市有几家网站公司
  • 宠物网站建站目标做外贸的网站哪些是最好的
  • 垂直型电商网站如何做html5 开发的网站
  • 做网站可以不做后端吗渭南网站建设网站排名优化
  • 在线建站网页制作网站建设平台工商营业执照官网
  • 做网站用到的软件h5交互设计
  • 化工废料网站建设企业网站建设联系电话
  • 浙江高端网站建设公司什么是网页开发
  • 石碣网站仿做模具做外贸网站
  • 定制网站建设成本制作公司宣传片
  • 青岛低价网站建设达内it教育官网
  • 洛阳设计网站公司个人网站管理系统
  • 怎么可以预览自己做的网站天津市城乡建设网站
  • 本地网站开发宁夏建设工程招标投标信息网站
  • 网站建设服务费怎么记账维护一个网站一年多少钱
  • 电子商务网站建设定位设想我的网站为什么打不开
  • 旅游网站开发方案ppt移动商城积分和积分区别
  • 如何做网站推广自己的产品WordPress+百度+主动
  • 商丘网站建设推广公司赣州seo唐三
  • 产品网站设计计算机专业做网站运营
  • 做平台网站怎么做的wordpress获取当前分类下的子分类