分类为 方法 的文章:
<template> <div id="app"> <router-view /> </div> </template> <script> export default { data() { return { waterMarkConfig: { width: 340, height: 240, content: '这里是水印内容,可以是 git commit id 或 process.env.NODE_ENV', font: '14px PingFang SC, sans-serif', ...
2022/09/26 浏览数(31)
启用防火墙 systemctl start firewalld firewall-cmd --add-service=http --permanent firewall-cmd --add-service=https --permanent firewall-cmd --remove-port=3306/tcp --permanent firewall-cmd --reload 启用交换空间 swap 分区 dd if=/dev/zero of=/swapfile bs=1024k count=8192 mkswap /swapfile swapon /swapfile echo "/swapfile swap swap defaults 0 0" >> /etc/fstab 软件源 ...
2022/07/11 浏览数(80)
安装Download URL Rewrite Module 2.1 /web.config <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="http2https" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input=&q...
2022/06/16 浏览数(99)
不推荐使用本文的方法,建议使用 props 和 emit 方法来自:stackoverflow.com/questions/55316490,在用这个方法前可以先试试 this.$refs[‘子组件’].doSth(),比下文的方法简单。 子组件 export default { methods: { doSth() { console.log('子组件的 doSth 方法'); }, }, mounted() { let self = this; self.$emit('callback', { doSth: () =&...
2022/05/24 浏览数(101)
# app/Providers/AppServiceProvider.php public function boot() { DB::listen(function ($query) { $location = collect(debug_backtrace())->filter(function ($trace) { return !str_contains($trace['file'], 'vendor/'); })->first(); // grab the first element of non vendor/ calls $bindings = implode(", ", $query->bindings); // format t...
2022/05/7 浏览数(98)
生成版本号配置的文件 hooks.js const packageInfo = require('./package.json'); const fs = require('fs'); const gitHEAD = fs.readFileSync('.git/HEAD', 'utf-8').trim(); const ref = gitHEAD.split(': ')[1]; let version = packageInfo.version; let commitId = ref ? fs.readFileSync('.git/' + ref, 'utf-8').trim() : gitHEAD; let date = (new Date()).toISOString(); let result = ` module.exports = {...
2022/04/19 浏览数(136)
.env APP_VERSION=v2.0.1 beta app/Http/Kernel.php protected $middleware = [ // ... \App\Http\Middleware\Version::class, // 在 http header 中返回当前接口的 Git 版本 ]; app/Http/Middleware/Version.php <?php namespace App\Http\Middleware; use Closure; use Illuminate\Http\Request; class Version { /** * 在 header 中添加项目 Git 库的 commit id * * @param...
2022/04/12 浏览数(129)
function dodash(callsign = '') { var sign = callsign.match(/[a-z0-9]+/)[0].toUpperCase(); var hash = 0x73e2; var i = 0; while (i < sign.length) { var f = sign[i].charCodeAt(); hash ^= f<<8; if (sign[i + 1]) { var s = sign[i+1].charCodeAt(); hash ^= s; } i += 2; } return Math.abs(hash); } var code = dodash('BZ0ZZZ'); co...
2021/03/29 浏览数(157)
const packageInfo = require('./package.json'); const fs = require('fs'); const gitHEAD = fs.readFileSync('.git/HEAD', 'utf-8').trim(); const ref = gitHEAD.split(': ')[1]; let version = packageInfo.version; let commitId = ''; if (ref) { commitId = fs.readFileSync('.git/' + ref, 'utf-8').trim(); } else { commitId = gitHEAD; } console.log(version, commitId); fs.readFile('./...
2020/12/28 浏览数(115)
介绍 laravel-nestedset(Nested Set Model) 安装 composer require kalnoy/nestedset 用法 // database/migrations/2020_08_10_155445_create_category_table.php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateCategoryTable extends Migration { public function up() { Schema::create('categor...
2020/12/28 浏览数(235)
当服务器宕机时,同一个页面的所有接口都会报错,导致页面出现一堆消息,本文方法可以让相同内容的消息只显示最后一个。 不支持 .error() 式的用法。 操作步骤 编辑 main.js,添加以下代码: import { Message } from 'element-ui'; var MessageStack = []; Vue.prototype.msg = function(config = {}) { MessageStack.forEach(function(item = {}) { if (item.message == config.message && item.type == ...
2020/11/10 浏览数(196)
仅支持无感知验证, vue-recaptcha-v3 yarn add vue-recaptcha-v3 src/main.js import { VueReCaptcha } from 'vue-recaptcha-v3'; Vue.use(VueReCaptcha, { siteKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', loaderOptions: { // 是否使用国内的 recaptcha.net 域名 useRecaptchaNet: true, // 是否隐藏“由reCAPTCHA 提供保护 隐私 - 使用条件” autoHideBadge: process.env.N...
2020/10/10 浏览数(226)
点击返回顶部
  1. 留言
  2. 联系方式