Vue3问题记录

123 阅读1分钟

开发Vue3的过程中遇到的问题记录

  1. Ref包裹值 取值要.value, reactive不需要

  2. nextTrick可以如下用:

import { ref, reactive, onMounted, getCurrentInstance } from "vue";

*const* {

  proxy: { $nextTick, $forceUpdate },

} = getCurrentInstance();
  1. Router这么用:
import { useRouter } from 'vue-router';

*const* Router = useRouter();
  1. Ref包裹的值外边是个proxy,可以下边这么取原来的json:
import { toRaw } from '@vue/reactivity';

*const* currentVal = toRaw(*value*);
  1. element-plus的message等这么用:
import { ElMessage, ElMessageBox } from "element-plus"; // messageconfirm弹窗
  1. Vue的问题:路由跳转params传参需要写name不能用path;

  2. Vue3 element table使用插槽slot方式:

#default="scope"

fixederioht nin-widthe100 class-npve- operate Tabele.png

  1. 引入背景图:使用require

srce1tem.1aage url classe 1age1.png

<Jiv class=creat order-riohtcon.png