文章分类 - 碎片化知识
摘要:示例 js downloadFunc(fieldsForm){ let fieldsParams = new URLSearchParams(fieldsForm) let searchFormParams = new URLSearchParams(this.searchForm) let url
阅读全文
摘要:示例 html <el-select v-model="runSelected" @change="runSelectedLoading = false" placeholder="请选择" filterable style="width: 150px" > <el-option v-for="(o
阅读全文
摘要:示例 class XxxFilterSet(FilterSet): field = filters.CharFilter(method='filter_multi_field', required=True) def filter_multi_field(self, queryset, name,
阅读全文
摘要:示例 html <div> <el-select v-model="form.xxx" placeholder="请选择(搜索不到可新增)" default-first-option automatic-dropdown filterable clearable > <i class="el-ico
阅读全文
摘要:示例、 视图中paginate_queryset返回None(推荐) class XxxView(ModelViewSet): def paginate_queryset(self, queryset): if self.request.GET.get('no_pagination', '').lo
阅读全文
摘要:思路 关键:django的视图本身返回的是json数据,而pandas本身就可以对json数据形成excel输出。所以,关键是拿到需要的json数据即可 突破点:无论是filterset还是serializers,都是支持手动使用的。 后端 def queryset_to_dataframe(que
阅读全文
摘要:示例 def process_exception(self, request, exception): """全局错误拦截""" error = { 'code': return_code.FAILED_ERROR, 'detail': str(exception), } return JsonRe
阅读全文
摘要:示例 <el-from :model="dataForm"> <el-row v-for="(version, i) in dataForm.versions" :key="'dataFormVersion-' + i" > <el-col :span="12"> <el-form-item lab
阅读全文
摘要:创建一个混入文件(例如 mixin.js) // mixin.js export const myMixin = { methods: { sharedMethod() { console.log('This is a shared method from mixin'); }, anotherSh
阅读全文
摘要:激活 只要在PeriodicTask中写入你的任务即会执行(类似写入linux的crontab) import pytz from django.conf import settings from django_celery_beat.models import CrontabSchedule, P
阅读全文
摘要:原理 django-celery-results的结果表,是由django_celery_results.models.TaskResult进行管理的 解决办法 from `django_celery_results.models import TaskResult task_qs = TaskRe
阅读全文
摘要:案例 解决办法 可以在console.log打印时加一个关键字如:my log,在控制台过滤器中输入关键字过滤即可 其他示例:
阅读全文
摘要:解决方案 在组件上使用属性: :select-when-unmatched = true: 回车时触发@select事件,收起建议框 使用组件方法: this.$refs.组件的ref名称.activated = false/true: false是关闭,true是打开建议框,根据你的逻辑使用。一般
阅读全文
摘要:示例方法 先正常点击激活,然后switch_to.active_element node = driver.find_element( By.CSS_SELECTOR, wuliu_num_css_selector ) node.click() self.bro.switch_to.active_e
阅读全文
摘要:解决办法 option = webdriver.ChromeOptions() option.add_argument('--disable-blink-features=AutomationControlled') # 令window.navigator.webdriver=false,隐藏驱动浏
阅读全文
摘要:示例 import re from django.conf import settings from ldap3 import Server, Connection, SIMPLE, SUBTREE ldap_server = Server(f'ldap://{settings.AD_HOST}')
阅读全文
摘要:思路 Date实例化时指定date为0即可获得上个月最后一天的Date实例 示例 lastMonthLastDate(){ const nowDate = new Date() let nowYear = nowDate.getFullYear() let nowMonth = (nowDate.g
阅读全文
摘要:技巧 $attrs v-bind="$attrs" 子组件使用v-bind="$attrs"可以将父组件所有传递、但子组件未在props中定义的属性绑定给子组件,inheritAttrs: false(与name同级)可以避免将属性绑定到非目标组件上 $listeners v-on="$listen
阅读全文
摘要:示例 html <el-table :data='xxx' ... @sort-change="({column, prop, order}) => { searchForm.order = order?`${order 'descending'?'-':''}${prop}`:null dataA
阅读全文
摘要:示例 html <el-table ... @filter-change="tableFilterChange($event, res => { filterParams = {...filterParams, ...res} dataApi.getData() // 自定义刷新数据类,目的是带过滤
阅读全文