分页: 4/273 第一页 上页 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 下页 最后页 [ 显示模式: 摘要 | 列表 ]
11月26

antdesign table key

09:14大前端 » vue.js  From: 本站原创
[codes=c#]
               :columns="columns"
               :data-source="list"
               :rowKey="
          (record, index) => {
            return index;
          }
        ">

[/codes]
11月25
[codes=c#]
import { defineAsyncComponent } from "vue"

// simple usage
const AsyncFoo = defineAsyncComponent(() => import("./demo.vue"))

// with options
const AsyncFooWithOptions = defineAsyncComponent({
  loader: () => import("./demo.vue"),
  loadingComponent: LoadingComponent,
  errorComponent: ErrorComponent,
  delay: 200,
  timeout: 3000
})

[/codes]

声明
[codes=c#]
export declare interface AsyncComponentOptions {
    loader: AsyncComponentLoader;
    loadingComponent?: Component;
    errorComponent?: Component;
    delay?: number;
    timeout?: number;
    suspensible?: boolean;
    onError?: (error: Error, retry: () => void, fail: () => void, attempts: number) => any;
}
[/codes]
11月25
package.json
[codes=c#]
  "dependencies": {
    "@ffmpeg-installer/ffmpeg": "^1.0.13",
    "fluent-ffmpeg": "^2.1.2"
  }
[/codes]

lib.js
[codes=c#]
const ffmpegInstaller = require('@ffmpeg-installer/ffmpeg');
const ffmpeg = require('fluent-ffmpeg');

ffmpeg.setFfmpegPath(ffmpegInstaller.path);
// console.log(ffmpegInstaller.path, ffmpegInstaller.version);

module.exports = ffmpeg;
[/codes]

app.js
[codes=c#]
const ffmpeg = require('./lib');

// cmd: ffmpeg -stream_loop -1 -i video.mp4 -f mpegts -codec:v mpeg1video -codec:a mp2 video.ts
const inputVideo = './video.mp4';
const outputVideo = './demo/video.ts';

var command = ffmpeg(inputVideo)
// set video bitrate
//  .videoBitrate(1024)
// set aspect ratio
//  .aspect('16:9')
// set size in percent
//  .size('50%')
// set fps
//  .fps(24)
.videoCodec('mpeg1video')
// set audio bitrate
.audioBitrate('128k')
// set audio codec
.audioCodec('mp2')
// 去掉声音
.noAudio()
// set number of audio channels
//  .audioChannels(2)
// set custom option
//  .addOption('-vtag', 'DIVX')
// set output format to force
.format('mpegts')
// setup event handlers
.on('end', function() {
  console.log('file has been converted succesfully');
})
.on('error', function(err) {
  console.log('an error happened: ' + err.message);
})
// save to file
.save(outputVideo);
[/codes]

代码见附件
下载文件 (已下载 0 次)
这个文件只能在登入之后下载。请先 注册登入

JAVA版本https://github.com/freedomdebug/ffmpeg
11月23
[codes=c#]
Parsing error: Must use import to load ES Module: F:\project\xxx\node_modules\eslint-scope\lib\definition.js
require() of ES modules is not supported.
require() of F:\project\xxx\node_modules\eslint-scope\lib\definition.js from F:\project\xxx\node_modules\babel-eslint\lib\require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename definition.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from F:\project\xxx\node_modules\eslint-scope\package.json.eslint
[/codes]

nodejs版本过高??
11月17
[codes=javascript]

[/codes]
11月17
vue3.2+ts+vite中eventBus
[codes=c#]
"mitt": "^3.0.0"

utils/eventBus.ts

import mitt from 'mitt'
const $eventBus = mitt();
export default $eventBus;

// xxx.vue

import $eventBus from '@/utils/eventBus';
$eventBus.emit('update', {});

// xxxuse.vue
onMounted(() => {
  $eventBus.on('update', (res: any) => {
    console.log(res);
  });
});
onBeforeUnmount(() => {
  $eventBus.off('update');
});
[/codes]
11月16
[@vue/compiler-sfc] defineProps is a compiler macro and no longer needs to be imported
>[@vue/compiler-sfc] `defineEmits` is a compiler macro and no longer needs to be imported.

"vite": "^2.6.4",
"vue": "^3.2.16",

新版中不需要显示引入了,
11月13

svelte学习

23:12软件分析与设计  From: 本站原创
最近初识这个框架,卷一下:

像她的英文

svelte
美: [svelt]
英: [svelt]
adj.  苗条的;身材修长的
网络  体态苗条的;苗条而优雅的;身材曼妙的

有兴趣的可以看看

https://www.sveltejs.cn/

一个基于svelte写的项目
https://github.com/freedomdebug/simple-cloud-music
11月11
env.d.ts
该文件中不要再写其他声明
[codes=c#]
///

declare module '*.vue' {
  import { DefineComponent } from 'vue'
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
  const component: DefineComponent<{}, {}, any>
  export default component
}

[/codes]
11月11
vite.config.js
[codes=c#]
import { defineConfig } from 'vite';
import path from 'path';
const  resolve = (dir) => { return path.join(__dirname, './', dir) };
defineConfig({
    resolve: {
      //tsconfig.json need set paths also
      alias: {
        '@/': `${resolve('src')}/`,
      }
    }
})
[/codes]

tsconfig.json
[codes=c#]
{
  "compilerOptions": {
    "paths": {
      "@/*": ["src/*"],
    },
}
[/codes]
分页: 4/273 第一页 上页 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 下页 最后页 [ 显示模式: 摘要 | 列表 ]