- 博客(24)
- 问答 (2)
- 收藏
- 关注
原创 路由首位两种写法
router.beforeEach((to, from, next) => { if(to.name != 'Home'){ if(localStorage.getItem('QZYtoken')){ next() }else{ alert('请先登录') } }else{ next() } }) router.beforeEach((to,from,next) => { const ...
2021-12-22 15:49:24
620
原创 uniapp请求封装
Vue.prototype.$BodyRequest = (url,method,data,success,fail)=>{ uni.request({ url:baseUrl+url, method:method, header:{ 'Authorization': 'Bearer '+uni.getStorageSync('token') }, data:...
2021-12-15 16:05:01
1203
原创 css3响应式
@media screen and (max-width: 1950px) { .OneMonth-center-box { padding: 50px 8%; } } @media screen and (max-width: 1800px) { .OneMonth-center-box { padding: 40px 13%; } } @medi...
2021-11-29 16:25:00
336
原创 vue监听浏览器窗口变化
window.addEventListener("resize", () => { this.screenWidth = document.body.clientWidth; this.screenHeight = document.body.clientHeight; });
2021-11-13 15:19:57
983
原创 全局前置路由导航守卫
发现全局路由导航守卫写if,else判断的时候,next好像并不能传参数,传参数会报错,造成死循环 import Vue from 'vue' import Router from 'vue-router' Vue.use(Router) // export default new Router({ // routes: [ // { // path: '/', // name: 'login', // component: resolve => ...
2021-11-13 09:21:47
942
原创 css修改滚动条样式
滚动条组成 ::-webkit-scrollbar 滚动条整体部分 ::-webkit-scrollbar-thumb滚动条里面的小方块,能向上向下移动(或往左往右移动,取决于是垂直滚动条还是水平滚动条) ::-webkit-scrollbar-track滚动条的轨道(里面装有Thumb) ::-webkit-scrollbar-button 滚动条的轨道的两端按钮,允许通过点击微调小方块的位置。 ::-webkit-scrollbar-track-piece 内层轨道,滚动条中间部分(除...
2021-11-11 14:10:05
328
原创 axios封装
import Vue from 'vue'; import axios from 'axios'; import { Loading,Toast} from "vant"; Vue.use(Toast); Vue.use(Loading); //请求头加上token信息 // axios.defaults.headers.common['blossom-auth'] = localStorage.getItem('token'); // 请求拦截器 axios.interceptors.request.
2021-10-14 14:48:23
85
原创 axios全局注册
Vue.prototype.$qingqiu = (url,data,keyi,buxing)=>{ axios.interceptors.request.use( config => { // 每次发送请求之前判断是否存在token,如果存在,则统一在http请求的header都加上token,不用每次请求都手动添加了 // 即使本地存在token,也有可能token是过期的,所以在响应拦截器中要对返回状态进行判断 const token = .
2021-10-14 14:17:40
377
原创 axios全局注册
Vue.prototype.$request = (url, mmethod,data, ok, failing, errorFun) => { axios({ method:"post", url: (url.substr(0,6)=="login?"?"":"/huint/")+url, headers: { token: localStorage.getItem("token") ? localStorage.getItem("token") : "",.
2021-10-14 14:13:34
167
原创 npm run build:yanshi
{ "name": "vue-element-admin", "version": "4.0.1", "description": "A magical vue admin. An out-of-box UI solution for enterprise applications. Newest development stack of vue. Lots of awesome features", "author": "Pan <panfree23@gmail.com>",.
2021-09-30 16:07:27
565
2
原创 添加树节点渲染内容
renderContent(h, { node, data, store }) { return ( <span class="custom-tree-node"> <span>{node.label}</span> <span style="padding-left:8px;"> <el-button size="mini" type="text" on-click={ () => this.createUs.
2021-09-28 10:26:23
156
原创 序列号写法
<el-table-column label="序号" width="60px" prop="id" align="center" fixed> <template slot-scope="scope"> <span>{{scope.$index + (page_number - 1) * page_count + 1}}</span> </template> </el-table-column>
2021-09-27 15:25:10
304
原创 axios的全局使用
Vue.prototype.$request = (url, mmethod,data, ok, failing, errorFun) => { axios({ method:"post", url: process.env.VUE_APP_BASE_API, headers: { 'Authorization': 'Basic eWljaHVuLWRhbmdqaWFuLWFkbWluOmJkOGQxZGM3N2JmMTVjMmY5OThiODFkZGUxMD.
2021-09-25 16:02:04
474
原创 for循环对象
for (const { name, prop, data, checkbox } of _this.childDialog) { if (name === _prop) { _this.childInfo.childData = data _this.childInfo.childProp = prop _this.childInfo.childName = name _this.childInfo.childCheck = checkbox _this.ch.
2021-09-23 14:53:35
997
1
原创 按钮权限处理
Vue.prototype.$btnshow=(routePath,btnname)=>{ let res=false; let i=0; //console.log(store.state.app.menus); var tmpoperate = []; if(store.state.app.menus) { while (i < store.state.app.menus.length) { let cmenu = store.state.ap.
2021-09-18 10:33:52
63
原创 自定义指令
Vue.directive('power', { inserted: function(el, bind) { // console.log(store.getters.button); if (bind.value != '') { console.log('陈伟') console.log(bind) const arr = bind.value.split(',').filter(item => { return stor.
2021-09-17 19:50:53
60
原创 FormData构造器的使用(一般用于文件上传)
var formData = new window.FormData() formData.append('file', file.raw) fileup(formData).then()
2021-09-16 17:41:50
125
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人