UNPKG

@sdc-monitor/demo

Version:

<div align="center"> <a href="#" target="_blank"> <img src="https://i.loli.net/2021/07/28/EvPwd4NjVH3tBfO.jpg" alt="mito-logo" height="90"> </a> <p>A Lightweight SDK For Monitor Web</p>

33 lines (31 loc) 1.02 kB
import { ViewModel } from '@sdc-monitor/types' import { getObjectWithForIn } from '@sdc-monitor/utils' export function vue2VmHandler(vm: ViewModel) { let componentName = '' if (vm.$root === vm) { componentName = 'root' } else { const name = vm._isVue ? (vm.$options && vm.$options.name) || (vm.$options && vm.$options._componentTag) : vm.name componentName = (name ? 'component <' + name + '>' : 'anonymous component') + (vm._isVue && vm.$options && vm.$options.__file ? ' at ' + (vm.$options && vm.$options.__file) : '') } return { componentName, propsData: vm.$options && vm.$options.propsData } } export function vue3VmHandler(vm: ViewModel) { let componentName = '' if (vm.$root === vm) { componentName = 'root' } else { console.log(vm.$options) const name = vm.$options && vm.$options.name componentName = name ? 'component <' + name + '>' : 'anonymous component' } return { componentName, propsData: getObjectWithForIn(vm.$props) } }