1000字范文,内容丰富有趣,学习的好帮手!
1000字范文 > 移动端调试工具 vconsole eruda 使用方法

移动端调试工具 vconsole eruda 使用方法

时间:2023-12-11 19:17:20

相关推荐

移动端调试工具 vconsole eruda 使用方法

移动端调试工具 vconsole、eruda 使用方法

一、eruda 安装main.js二、 vconsole1.salesHome.vue2.postMessageWithNative.js

一、eruda 安装

npm install eruda --save

main.js

import eruda from 'eruda'import UmsApp from 'UmsApp'if (判断条件 === 'development') {eruda.init()}

二、 vconsole

1.salesHome.vue

<template><div id="mobilehome"><keep-alive :include="aliveArr"><router-view v-if="isLoad"></router-view></keep-alive><remote-js :src="jsdkUrl" @load="load"></remote-js></div></template><script>import {mapState } from 'vuex'import postMessageWithNative from './mixins/postMessageWithNative'export default {name: 'saleshome',mixins: [postMessageWithNative],data() {return {jsdkUrl:process.env.NODE_ENV === 'development'? 'https://url/jssdk/flaginfo.jssdk.min.js?debug=true': 'https://url/jssdk/flaginfo.jssdk.min.js',isLoad: false,}},computed: {...mapState(['aliveArr']),},components: {},methods: {load() {this.getuserInfo()},//获取个人信息getuserInfo() {const {token } = this.$route.queryconst _this = thisif (token) {this.isLoad = truethis.$store.dispatch('SET_TOKEN', token)} else {if (fi.isUmsApp()) {fi.ready(function () {UmsApp.action.msession({}, function (err, data) {window.UmsApp = UmsAppconst isApp = true_this.$mit('setIsApp', isApp)_this.isLoad = true_this.$store.dispatch('SET_TOKEN', data.token)})})} else {this.isLoad = true}}},},mounted() {},}</script><style lang="scss" scoped></style>

2.postMessageWithNative.js

export default {components: {'remote-js': {render(createElement) {const _this = thisreturn createElement('script',{attrs: {type: 'text/javascript', src: this.src},on: {load: function (event) {console.log('load')_this.$emit('load', event)}}});},props: {src: {type: String, required: true}}}}}

链接: /qq_36651686/article/details/116653983?utm_medium=distribute.pc_aggpage_search_result.none-task-blog-2aggregatepagefirst_rank_v2~rank_aggregation-1-116653983.pc_agg_rank_aggregation&utm_term=eruda%E7%9A%84%E4%BD%BF%E7%94%A8&spm=1000.2123.3001.4430.

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。