当前位置: 首页 > 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.zqtcl.cn/news/987597/

相关文章:

  • html5 手机 网站盘锦建设工程信息网站
  • 高端企业网站定制公司wordpress喜欢_赏_分享
  • 网站开发推广方案策划书开发公司移交给物业资料说明
  • 做响应式网站的菜单中国造价网官网
  • 爱心捐赠网站怎么做中国机械网官网
  • 好的ftp网站微信小程序开发基础
  • 西安 网站 公司wordpress+帖子置顶
  • 广州开发网站服务上海千途网站建设
  • 网站建设功能分为几种百度搜索数据
  • 电影网站模板html微信开发者代码管理
  • 小程序ui界面设计手机优化大师官网
  • 佳木斯市建设局网站网络游戏名
  • 建筑钢结构网站汉阳网站建设哪家便宜
  • 营销型网站建设评价临湘网站建设
  • 做网站的价格参考巴中建网站的公司
  • 张家口建设网站网络技术工程师
  • 大型网站后台登录地址一般是如何设置的哪里网站用vue.js做的
  • 网页设计规范图标设计百度seo优化多少钱
  • 网站打开速度概念建筑网站知乎
  • 网站的flash怎么做的杭州市城乡建设网官网
  • 宿迁网站建设排名wordpress多站点可视化
  • 苏州好的做网站的公司哪家好前端如何做响应式网站
  • 广州网站建设招标推广方式有哪些渠道
  • 郑州做网站狼牙东莞建设造价信息网站
  • 网站制作代理加盟国内seo服务商
  • 如何在建设银行网站预约纪念币网络销售好不好做
  • 利用淘宝视频服务做视频网站聊城做网站价格
  • 做美容行业的网站哪个好广西互联网企业
  • 做网站平台的营业执照江镇做包子网站
  • 网站建设 摄影服务wordpress破解模板