封装
文章平均质量分 54
Elaine Cc
这个作者很懒,什么都没留下…
展开
-
vue用Symbol方式全局封装Iconfont阿里巴巴矢量库图标组件
一、在components路径下创建IconSvg文件夹并在IconSvg下创建IconSvg.vue文件、index.js文件Iconsvg.vue文件代码<template> <div> <span class="iconfont" :class="iconTag"></span> <slot></slot> </div></template><script&g原创 2021-12-03 11:48:26 · 998 阅读 · 0 评论 -
Vue全局封装axios请求
一、安装axiosnpm install axios二、在src目录下,新建api文件夹,并创建http.js和index.js文件三、http.js具体内容import axios from 'axios';import router from "../router/index";axios.defaults.timeout = 5000; //超时时间5s//axios.defaults.withCredentials = true; //允许跨域//Con原创 2021-03-23 20:59:56 · 278 阅读 · 0 评论 -
Symbol方式封装iconfont图标组件
一、创建IconSvg组件IconSvg.vue<template> <svg class="svg-icon" aria-hidden="true"> <use :xlink:href="iconName"></use> </svg></template><script> export default { name: "IconSvg", props: { ico原创 2020-10-30 13:59:00 · 795 阅读 · 0 评论 -
Vue CLI3封装Message、Toast成插件
封装Toast跟封装Message的方法类似,这里以封装Message为例:1、在component创建对应文件Message.vue<template> <div class="message_row display_animation" v-show="isShow"> <div class="message_contain"> <div class="message_box"> <icon-svg :原创 2020-10-30 13:45:49 · 1159 阅读 · 0 评论 -
js排序方法
数组对象方法排序function sortByKey(array , key){ return array.sort(function(a, b){ var x = a[key]; var y = b[key]; return ((x<y) ? -1 : ((x>y) ? 1 : 0)); });}数组排序function sortNumber(a , b){ return a-b;}原创 2020-08-12 15:59:51 · 176 阅读 · 0 评论 -
微信小程序---封装请求后端接口
下面展示是 后端请求接口。config- index.jsconst config = { //项目名称 projectName: '', //作者(开发团队) author: '', //请求的配置 request:{ //请求域名--结尾请勿包含斜杠‘/’ host: "https://XXX.XXX.com", Language: 'zh', Device: '', },} module.exports = config;uti原创 2020-08-05 11:30:15 · 657 阅读 · 0 评论