![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Vue
文章平均质量分 58
花荞
这个作者很懒,什么都没留下…
展开
-
upload上传组件点击上传按钮,弹出文件框前出现提示框
选择文件前,需要询问用户此次选择的文件是否为证书,若是,就会新加一个字段。原创 2022-09-29 10:42:21 · 1456 阅读 · 0 评论 -
Vue传值
传值 通过路由带参数进行传值。 通过设置Session Storage 缓存的形式进行传值。 // A组件缓存user const user = { 'name': 'Lucy', 'age': 18} sessionStorage.setItem('缓存名称', JSON.stringify(user)) // B组件获取缓存 const userB = JSON.parse(sessionStorage.getItem('缓存名称')) 父组件传值给子组件 如果参数很多,可以使用json 数组转载 2021-07-05 14:33:14 · 378 阅读 · 0 评论 -
Vue路由
路由传值的方法和区别 区别 this.$router:VueRouter 的实例,要导航到不同的URL,就要使用$router.push() this.$route:当前router 跳转的对象,可以获取到name、path、query、params等。 { path: '/home', name: 'home', component: Home }, 传参 使用$router.push 拼接参数传参。 // userName=one 就是传递的参数 this.$router.push('/转载 2021-07-05 10:36:56 · 39 阅读 · 0 评论 -
watch和computed的区别
watch 主要用于监控vue实例的变化,它监控的变量必须在data里面声明才可以,它可以监控一个变量,也可以是一个对象,也可以监控对象里面的属性。 data() { className: "三年级五班", studentInfo: { name: "王富贵", sex: "女", age: 21, } }, watch: { // 监控单个变量 className(newVal, oldVal) { console.log("新值:" + newVal, "旧值:" + ol转载 2021-06-15 14:47:19 · 116 阅读 · 0 评论