
vue.js
大可&不必
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
vue中request和response请求拦截器
request 请求拦截器,有token值则配置上token值axios.interceptors.request.use(config=>{ if(token && config.url != "/login"){ config.headers['Authentication'] = token } return config;},error=>{ console.log(error); Promise.reject(error原创 2021-08-25 10:35:41 · 3163 阅读 · 0 评论 -
vuex的使用方法
npm install vuex -s在src下创建store,文件夹下创建index.jsimport Vue from 'vue';import Vuex from 'vuex';Vue.use(Vuex);const store = new Vuex.Store({ state:{ count: 0 }, getters:{ }, mutations:{ increment (state) {原创 2021-03-04 17:10:46 · 141 阅读 · 1 评论 -
vue跳转页面传递参数的三种方法
vue中this.$router.push()路由传值和获取的两种常见方法path不能和params一起使用,否则params将无效。需要用name来指定页面。使用params传参要用name不能使用path只是大概的介绍一下,如果想看详细的参数用法可以查看我下面的文章https://blog.youkuaiyun.com/style201904/article/details/102605338第一种方法query传参this.$router.push({path:'/business',query:{w原创 2020-12-09 15:00:50 · 3098 阅读 · 0 评论 -
vue中父子组件之间通信的方法
<!-- 父传子(props) 父组件father.vue --><template> <div> <div>father组件</div> <div>父组件要传给子组件的参数:{{msg}}</div> <!-- 1.传递:data1为动态参数msg的参数名,名字自定义,与子组件接收参数名同名 data2为静态参数的参数名,名字自定义,与子组件接收参数名同名 --> .原创 2020-12-08 10:12:21 · 193 阅读 · 0 评论 -
vue登录请求拦截响应,携带token
main.js//引入axiosVue.prototype.$axios = axios;axios.defaults.baseURL='http://127.0.0.1:8080/';axios.interceptors.request.use((config) => { config.headers.token = localStorage.getItem('token');; return config;});axios.interceptors.response.use((c原创 2020-07-07 17:20:02 · 1183 阅读 · 0 评论 -
vuex封装购物车函数
js import Vue from 'vue'import Vuex from 'vuex'Vue.use(Vuex)export default new Vuex.Store({ state:{ shopCart:[], allChecked:false }, mutations:{ setShopCart(...原创 2019-11-22 15:51:20 · 271 阅读 · 0 评论 -
vue中的三种传递参数方法
<div class="shopLine" @click="goDetails(item.id)" v-for="item,index in cart"><button @click="goThird">点击跳转第二种方式传参</button><button @click="goSi">点击跳转第三种方式传参</button>在m...原创 2019-10-17 14:10:53 · 12082 阅读 · 1 评论 -
使用D3渲染中国地图
//1、先在页面中初始化一个svg标签 var w = 1000,h = 1000; var svg = d3.select('body') .append('svg') .attr('width',w) .attr('height',h) .attr('transform','translate(0,0)'); //d3.geo 是d3中一些...原创 2019-08-27 21:25:14 · 2040 阅读 · 0 评论 -
uniapp新闻项目
创建项目 uni-app创建 hello uni-app 项目把hello项目的common和components文件复制过来page、index.vue<template> <view class="content"> <view class="uni-list"> <view class="uni-list-cell" h...原创 2019-09-28 19:19:33 · 4340 阅读 · 4 评论