# FAQ

# 怎么实现Vue2中的Vue.extend()的效果

  • 使用createApp
import { createApp } from 'vue'
import Component from './component'

return function openDialog(props) {
  return createApp({ extends: Components }, props).mount().$el
}

# Vue3.2 以后可不不需要导入编译宏

  • 编译宏包括defineProps(),defineEmits(),defineOptions(),defineExpose()...但是Eslint会提示no-undef错误
  • 解决办法:
  1. 安装vue-eslint-parserv9.0.0+版本,

建议

eslint版本最好8.0+。

npm i -D vue-eslint-parser
  1. 配置.eslintrc.js文件
module.exports = {
  // ...
  parser: 'vue-eslint-parser',
  'extends': [
    'eslint:recommended',
    // ...
  

# Vue 热更新失效

  • 问题:创建项目的时候发现热更新失效,以为是配置问题,怎么修改配置都无法打开热更新, 同时发现无法通过network方法打开本地项目,只能通过localhost打开
  • 原因:开启了VPN好像会导致此情况