https://juejin.im/post/6872128694639394830
vue3.0 ts 知乎
http://docs.vikingship.xyz/
vue3 ts
https://mp.weixin.qq.com/s/fo3_KwiKtRLVs6BUfe3iVg
let url = "/api/privilege/stcommon/getCurrentUser";const config = {headers:{'Authorization':'Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhcWhiYy5uaiIsImV4cCI6MTYwMTExNTUxMywiaWF0IjoxNjAxMTE1NTEzfQ.Nq1NxfKjFoV_SwJfiFDU6Mrp1KM-Lb30-0pevQm6rg8','Content-Type' : 'application/json; charset=utf-8','token': 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhcWhiYy5uaiIsImV4cCI6MTYwMTExNTUxMywiaWF0IjoxNjAxMTE1NTEzfQ.Nq1NxfKjFoV_SwJfiFDU6Mrp1KM-Lb30-0pevQm6rg8'}}this.$axios.get(url,config).then((res)=>{const data = res.data;this.$store.commit("wopcStoreModules/pushWopcUserInfo",data)console.log(res)}).catch(e=>{console.log(e)})
localhost; 127.0.0.1; %ComputerName%;*.cnpc;10.*;11.*;*.cnpc.com.cn;*.petrochina;*.local
vue中,使用element ui的el-dialog echarts出错问题
https://www.cnblogs.com/yanyanliu/p/11729876.html
常用Vue组件
打印 - Print.js
Github:https://github.com/crabbly/Print.js官方文档:http://printjs.crabbly.com打印网页示例(继承样式)打印Json数据示例截屏 - html2canvas
Github:https://github.com/niklasvh/html2canvas官方文档:https://html2canvas.hertzen.com截取网页示例截取指定内容示例打印 + 截屏 实现网页样式不丢失打印
打印原样式网页图片示例复制命令 - vue-clipboard2
Github:https://github.com/Inndy/vue-clipboard2官方文档:https://github.com/Inndy/vue-clipboard2复制文本示例轻量级时间转换工具 - date-fns
Github:https://github.com/date-fns/date-fns官方文档:https://date-fns.org已全局挂载 format 方法示例:2021-05-16拖动组件 - Vue.Draggable
Github:https://github.com/SortableJS/Vue.Draggable官网:https://sortablejs.github.io/Vue.Draggable/
- A
- B
- C
图片懒加载 - vue-lazyload
Github:https://github.com/hilongjw/vue-lazyload官网:http://hilongjw.github.io/vue-lazyload文件保存导出下载 - FileSaver.js
Github:https://github.com/eligrey/FileSaver.js官网:https://github.com/eligrey/FileSaver.js
ElementUI
穿梭框使用
<template><div id="app-auth-zsmart"><el-dialog title="综调中心职位授权" :visible.sync="open" width="1200px" :before-close="handleClose" append-to-body:close-on-click-modal="false"><el-transfer v-model="value" :data="listData":titles="['未授权', '已授权']":props="{key: 'orgJobId',label: 'jobName',disabled: 'disabled'}"@change="handleChange"><!-- <span slot-scope="{ option }">{{ option.staffOrgId }} - {{ option.jobName }}</span>--><span slot-scope="{ option }"><span style="font-size: 6px;color: red;">{{ option.orgName }}</span> <span style="font-size: 8px;">{{ option.jobName }}</span></span></el-transfer><div slot="footer" class="dialog-footer"><el-button type="primary" @click="handleOk" size="mini">确 定</el-button><!-- <el-button @click="handleClose" size="mini">取 消</el-button>--></div></el-dialog></div></template><script>import { fetchZsMartAuthedJobList, fetchZsMartAuthJobList, updateZsMartUserWithJob } from '@/api/rl/rlAuthZsmartApi'import _ from 'lodash'export default {props: {open: {type: Boolean,default: false},userName: {type: String,default: ''}},name: 'DialogAuthZsmartNew',components: {},data() {return {authList:[],authedList:[],listData: [],value: []}},created() {this.init()const userId = this.$route.params && this.$route.params.userIdconsole.log(`userId:${userId}`)},methods: {async init() {const authData = await fetchZsMartAuthJobList(this.userName);this.authList = authData.dataconst authedData = await fetchZsMartAuthedJobList(this.userName);this.authedList = authedData.datathis.listData = _.forEach(this.authList,v1=>{let flag = true_.forEach(this.authedList,v2=>{let allJobId = v1.orgId+"_"+v1.jobId;let singleJobId = v2.orgId+"_"+v2.jobId;if(allJobId === singleJobId){flag =false;this.value.push(v1.orgJobId)}})})console.log(this.listData)},handleOk() {this.$emit('update:open', false)this.$emit('change')},handleClose() {this.$emit('update:open', false)},// 穿梭框更改事件async handleChange (value, direction, keyArr) {//value为左/右的所有数值,direction为方向left or right,keyArr为选中的keyswitch (direction) {//右到左 解绑case 'left':// 调用后端api绑定接口console.log(keyArr)let delJobList = [];_.forEach(this.listData,v=>{_.forEach(keyArr,val=>{if(v.orgJobId === val){console.log('匹配项:')console.log(v)delJobList.push(v)}})})console.log('待删除数据:{}')console.log(delJobList)const delParam = {'addJobList': [],'deleteJobList':delJobList,'userId': this.$route.params && this.$route.params.userId}// 提交数据await updateZsMartUserWithJob(delParam).then(res => {this.msgSuccess('操作成功')}).catch(e => {this.msgError('操作失败')})break//从左到右 绑定case 'right':// 调用后端api解绑接口let addJobList = [];_.forEach(this.listData,v=>{_.forEach(keyArr,val=>{if(v.orgJobId === val){console.log('匹配项:')console.log(v)addJobList.push(v)}})})console.log('待新增数据:{}')console.log(addJobList)const reqParam = {'addJobList': addJobList,'deleteJobList': [],'userId': this.$route.params && this.$route.params.userId}// 提交数据await updateZsMartUserWithJob(reqParam).then(res => {this.msgSuccess('操作成功')}).catch(e => {this.msgError('操作失败')})break}}}}</script><style lang="scss" scoped>// scss 样式穿透::v-deep .el-transfer{display: flex;align-items: center;height: 400px;.el-transfer-panel{width: 500px;}.el-transfer-panel__list.is-filterable {height: 400px;}.el-transfer__buttons{display: flex;flex-direction: column;align-items: center;justify-content: center;.el-button.el-button--primary{margin-left: 0;}}}</style>
