How does vue simulate browser console output?

it is not convenient for the mobile phone to watch console.log (), so write a component to display it directly on the screen

<template>
    <ul class="log-screen">
        <li v-for="(log, index) in dataLog">{{log.text}}<i v-if="log.repeat">{{log.repeat}}</i></li>
    </ul>
</template>
<script>
export default {
    name: "log-screen",
    data() {
        return {
            lastMsg:"",
            dataLog:[{
                text:"",
                repeat:2
            }]
        };
    },
    methods: {
        log(l){
            if (lastMsg === l) {
                let idx = this.dataLog.length-1;
                this.dataLog[idx].repeat += 1;
            }else{
                this.dataLog.push({
                    text:l,
                    repeat:0
                });
            }
        }
    },
}

is it appropriate to write in this way?

Jun.04,2021

commonly used console debugging on mobile phone
there is a vconsole

GitHub address:
https://github.com/shouzijian.

you can adjust it and use

directly.

recommend a debug artifact on mobile: eruda to facilitate viewing various log.

will often have some interesting projects in github Star and open source. Welcome follow me. Welcome. https://github.com/simbawus

.
Menu