logo
publist
写文章

简介

该用户还未填写简介

擅长的技术栈

可提供的服务

暂无可提供的服务

vue3.0——keep-alive缓存

通过路由配置keepAlive判断是否缓存当在内部切换组件时,将相应地调用其onActivated(缓存激活)和onDeactivated(在组件切换中老组件消失的时候执行)生命周期挂钩。一.路由配置:import { createRouter, createWebHashHistory } from 'vue-router';import Home from '../views/Home.vue

vue3.0——父子组件相互调用方法

//子组件<template><div class="hello"><span>{{ msg }}</span><div></div><span>{{ num }}</span><button @click="add">+</button></div></tem

vue3.0事件总线

Vue3.x以后从实例中移除了 on,on,on,off 和 once方法,once 方法,once方法,emit 仍然是现有 API 的一部分,只能实现子组件触发父组件的方法。使用mitt之前先安装mitt模块npm install --save mitt或者yarn add mitt -S然后在程序中使用事件总线:main.js配置import { createApp } from 'vue'

vue中报warnings potentially fixable with the `--fix` option.

1、warnings potentially fixable with the --fix option.如图:"scripts": {"serve": "vue-cli-service serve","build": "vue-cli-service build","lint": "eslint --fix --ext .js,.vue src"},将:“lint”: “vue-cli-serv

vue中提示框driver.js

安装模块依赖:yarn add driver.jsnpm install driver.js创建独立步骤配置guide.js文件:const steps = [{element: "#guide-menu",popover: {className: "box", //添加新类title: "菜单导航",description: "点击菜单可切换右侧菜单内容",position: "top",off

vue3.0中vuex的使用

首先,vuex中有默认的五个核心概念:state:存储状态(变量)getters:对数据获取之前的再次编译,可以理解为state的计算属性。在组件中通过 this.$store.getters.xxx使用mutations:修改状态,并且是同步的。在组件中通过this.$store.commit(‘xxx’,params)使用。这个和我们组件中的自定义事件类似。actions:提交 mutatio

vue3.0路由跳转传参和参数获取方式

方法一:import { useRouter } from "vue-router";//引入路由setup() {//实例化路由const router = useRouter();console.log(router.currentRoute.value.query.id);//获取参数//路由跳转方法function goHome() {//不带参数// router.push("/");/

到底了