@hyext/builder-revues 0.0.1-beta.17 → 0.0.1-beta.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +154 -42
- package/package.json +8 -7
- package/static/template/remote-debugger.hbs +61 -0
package/dist/index.js
CHANGED
@@ -9,12 +9,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
10
10
|
var fs = require('fs-extra');
|
11
11
|
var path = require('path');
|
12
|
-
var os = require('os');
|
13
12
|
var codeCompiler = require('@revues/code-compiler');
|
13
|
+
var os = require('os');
|
14
14
|
var chalk = require('chalk');
|
15
15
|
var util = require('util');
|
16
16
|
var glob = require('glob');
|
17
17
|
var handlebars = require('handlebars');
|
18
|
+
var tapable = require('tapable');
|
18
19
|
var liveServer = require('live-server');
|
19
20
|
var archiver = require('archiver');
|
20
21
|
var R = require('ramda');
|
@@ -40,7 +41,14 @@ const tempDir = os__default["default"].tmpdir();
|
|
40
41
|
const cacheDir = path__default["default"].join(tempDir, '.revue_cache');
|
41
42
|
// 根据环境变量判断 要不要把运行框架代码留在项目内 还是 CDN
|
42
43
|
const deployMode = EDeployMode.Integration;
|
43
|
-
const staticPath = path__default["default"].resolve(__dirname, '../static' );
|
44
|
+
const staticPath = path__default["default"].resolve(__dirname, '../static' );
|
45
|
+
var COMPILE_TYPE;
|
46
|
+
(function (COMPILE_TYPE) {
|
47
|
+
COMPILE_TYPE["miniProgram"] = "miniProgram";
|
48
|
+
COMPILE_TYPE["miniProgramPlugin"] = "miniProgramPlugin";
|
49
|
+
COMPILE_TYPE["miniGame"] = "miniGame";
|
50
|
+
COMPILE_TYPE["miniGamePlugin"] = "miniGamePlugin";
|
51
|
+
})(COMPILE_TYPE || (COMPILE_TYPE = {}));
|
44
52
|
|
45
53
|
const filename = 'project.config.json';
|
46
54
|
function copyProjectConfigJSON(srcDir, destDir) {
|
@@ -145,6 +153,45 @@ function renderTemplate(input, output, data) {
|
|
145
153
|
fs__default["default"].outputFileSync(output, render(content, data));
|
146
154
|
}
|
147
155
|
|
156
|
+
const PluginDriver = {
|
157
|
+
context: { deviceOrientation: 'portrait', },
|
158
|
+
hooks: {
|
159
|
+
onMergedMainPackge: new tapable.SyncHook(['IOnMergedMainPackge'])
|
160
|
+
}
|
161
|
+
};
|
162
|
+
|
163
|
+
class InjectWebviewUrlParamsPlugin {
|
164
|
+
apply(pluginDriver) {
|
165
|
+
pluginDriver.hooks.onMergedMainPackge.tap('InjectWebviewUrlParamsPlugin', opts => {
|
166
|
+
const { compileType, mainPath } = opts;
|
167
|
+
let isLandscape = 0;
|
168
|
+
const isGame = compileType === COMPILE_TYPE.miniGame;
|
169
|
+
if (isGame) {
|
170
|
+
const gameJson = fs__default["default"].readJsonSync(path__default["default"].join(mainPath, 'game.json'));
|
171
|
+
if (typeof gameJson.deviceOrientation === 'string' &&
|
172
|
+
gameJson.deviceOrientation.includes('landscape')) {
|
173
|
+
isLandscape = 1;
|
174
|
+
}
|
175
|
+
}
|
176
|
+
pluginDriver.context.webviewUrlParams = {
|
177
|
+
isLandscape,
|
178
|
+
disablePopGesture: 1,
|
179
|
+
hideStatusBar: isGame ? 1 : 0,
|
180
|
+
hideBar: 1,
|
181
|
+
bounces: 0
|
182
|
+
};
|
183
|
+
});
|
184
|
+
}
|
185
|
+
}
|
186
|
+
function makeWebviewUrlParamsStr() {
|
187
|
+
const params = PluginDriver.context.webviewUrlParams;
|
188
|
+
return params ? Object.keys(params).reduce((str, key) => {
|
189
|
+
// @ts-ignore
|
190
|
+
str += `&${key}=${encodeURIComponent(params[key])}`;
|
191
|
+
return str;
|
192
|
+
}, '') : '';
|
193
|
+
}
|
194
|
+
|
148
195
|
function isMainPackage(config) {
|
149
196
|
return config.name === codeCompiler.pkgFileType.MainPkg && config.root === '.';
|
150
197
|
}
|
@@ -235,7 +282,7 @@ function mergeGamePackage(releasePath, opts) {
|
|
235
282
|
const { mainPakConf, packagePath } = mergeMainPackage(watch, releasePath);
|
236
283
|
const templatePath = path__default["default"].join(staticPath, 'template');
|
237
284
|
const mainPath = path__default["default"].join(packagePath, mainPakConf.name);
|
238
|
-
const entrys = builderConfig.supportExtTypes.map(
|
285
|
+
const entrys = builderConfig.supportExtTypes.map(extType => {
|
239
286
|
const entryFilename = `index_${extType}.html`;
|
240
287
|
return {
|
241
288
|
extType,
|
@@ -248,6 +295,11 @@ function mergeGamePackage(releasePath, opts) {
|
|
248
295
|
entryFilename
|
249
296
|
};
|
250
297
|
});
|
298
|
+
PluginDriver.hooks.onMergedMainPackge.call({
|
299
|
+
mainConf: mainPakConf,
|
300
|
+
mainPath,
|
301
|
+
compileType: COMPILE_TYPE.miniGame
|
302
|
+
});
|
251
303
|
if (!watch) {
|
252
304
|
// 渲染模版
|
253
305
|
renderGameTemplate({
|
@@ -257,23 +309,40 @@ function mergeGamePackage(releasePath, opts) {
|
|
257
309
|
: publicPath,
|
258
310
|
templatePath,
|
259
311
|
mainPath,
|
312
|
+
extUuid,
|
260
313
|
...opts.template
|
261
314
|
});
|
262
315
|
// wasn文件 会被 cocos 同步请求,由于二进制文件同步请求失败 所以改为 base64 文本
|
263
316
|
transformWasnFileToBase64File(mainPath);
|
264
317
|
}
|
265
|
-
return
|
318
|
+
return {
|
319
|
+
entrys,
|
320
|
+
mainPublicPath: 'package/' + mainPakConf.name
|
321
|
+
};
|
266
322
|
}
|
323
|
+
// mark 热更新 整个函数不会重渲染。
|
267
324
|
function renderGameTemplate(opts) {
|
268
|
-
const { mainPath, sourcePathPrefix, templatePath, entrys, debug } = opts;
|
269
|
-
const
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
325
|
+
const { mainPath, sourcePathPrefix, templatePath, entrys, debug, dev, extUuid } = opts;
|
326
|
+
const renderConfigList = [
|
327
|
+
{
|
328
|
+
input: path__default["default"].join(templatePath, 'game-frame.hbs'),
|
329
|
+
output: path__default["default"].join(mainPath, 'game-frame.html'),
|
330
|
+
data: {
|
331
|
+
sourcePathPrefix
|
332
|
+
}
|
274
333
|
}
|
275
|
-
|
276
|
-
|
334
|
+
];
|
335
|
+
if (dev) {
|
336
|
+
renderConfigList.push({
|
337
|
+
input: path__default["default"].join(templatePath, 'remote-debugger.hbs'),
|
338
|
+
output: path__default["default"].join(mainPath, 'remote-debugger.html'),
|
339
|
+
data: {
|
340
|
+
extUuid,
|
341
|
+
paramsStr: makeWebviewUrlParamsStr()
|
342
|
+
}
|
343
|
+
});
|
344
|
+
}
|
345
|
+
const entryRenderConfList = entrys.map(info => {
|
277
346
|
return {
|
278
347
|
input: path__default["default"].join(templatePath, 'minigame-page-manager.hbs'),
|
279
348
|
output: path__default["default"].join(mainPath, info.entryFilename),
|
@@ -284,8 +353,7 @@ function renderGameTemplate(opts) {
|
|
284
353
|
}
|
285
354
|
};
|
286
355
|
});
|
287
|
-
|
288
|
-
entryRenderConfList.concat(gameFrameRenderItem).forEach(config => {
|
356
|
+
entryRenderConfList.concat(renderConfigList).forEach(config => {
|
289
357
|
renderTemplate(config.input, config.output, config.data);
|
290
358
|
});
|
291
359
|
}
|
@@ -306,7 +374,7 @@ function transformWasnFileToBase64File(mainPath) {
|
|
306
374
|
nodir: true,
|
307
375
|
absolute: false
|
308
376
|
});
|
309
|
-
console.log('transform wasm to base64 files: \n', files);
|
377
|
+
files.length && console.log('transform wasm to base64 files: \n', files);
|
310
378
|
files.forEach(file => {
|
311
379
|
const abs = path__default["default"].join(mainPath, file);
|
312
380
|
const text = fs__default["default"].readFileSync(abs).toString('base64');
|
@@ -335,7 +403,7 @@ function mergeMiniprogramPackage(releasePath, opts) {
|
|
335
403
|
const extConfig = getPackageExtConfig(packagePath);
|
336
404
|
const templatePath = path__default["default"].join(staticPath, 'template');
|
337
405
|
const mainPath = path__default["default"].join(packagePath, mainPakConf.name);
|
338
|
-
const entrys = builderConfig.supportExtTypes.map(
|
406
|
+
const entrys = builderConfig.supportExtTypes.map(extType => {
|
339
407
|
const entryFilename = `index_${extType}.html`;
|
340
408
|
return {
|
341
409
|
extType,
|
@@ -348,6 +416,11 @@ function mergeMiniprogramPackage(releasePath, opts) {
|
|
348
416
|
entryFilename
|
349
417
|
};
|
350
418
|
});
|
419
|
+
PluginDriver.hooks.onMergedMainPackge.call({
|
420
|
+
mainConf: mainPakConf,
|
421
|
+
mainPath,
|
422
|
+
compileType: COMPILE_TYPE.miniProgram
|
423
|
+
});
|
351
424
|
if (!watch) {
|
352
425
|
// 渲染模版
|
353
426
|
renderMiniprogramTemplate({
|
@@ -358,22 +431,35 @@ function mergeMiniprogramPackage(releasePath, opts) {
|
|
358
431
|
packageExtConfig: extConfig,
|
359
432
|
templatePath,
|
360
433
|
mainPath,
|
434
|
+
extUuid,
|
361
435
|
...opts.template
|
362
436
|
});
|
363
437
|
}
|
364
|
-
return entrys;
|
438
|
+
return { entrys, mainPublicPath: 'package/' + mainPakConf.name };
|
365
439
|
}
|
366
440
|
function renderMiniprogramTemplate(opts) {
|
367
|
-
const { mainPath, sourcePathPrefix, templatePath, entrys, packageExtConfig, debug } = opts;
|
441
|
+
const { mainPath, sourcePathPrefix, templatePath, entrys, packageExtConfig, debug, dev, extUuid } = opts;
|
368
442
|
const packageExtConfigStr = JSON.stringify(packageExtConfig);
|
369
|
-
const
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
443
|
+
const renderConfigList = [
|
444
|
+
{
|
445
|
+
input: path__default["default"].join(templatePath, 'service.hbs'),
|
446
|
+
output: path__default["default"].join(mainPath, 'service.html'),
|
447
|
+
data: {
|
448
|
+
sourcePathPrefix
|
449
|
+
}
|
374
450
|
}
|
375
|
-
|
376
|
-
|
451
|
+
];
|
452
|
+
if (dev) {
|
453
|
+
renderConfigList.push({
|
454
|
+
input: path__default["default"].join(templatePath, 'remote-debugger.hbs'),
|
455
|
+
output: path__default["default"].join(mainPath, 'remote-debugger.html'),
|
456
|
+
data: {
|
457
|
+
extUuid,
|
458
|
+
paramsStr: makeWebviewUrlParamsStr()
|
459
|
+
}
|
460
|
+
});
|
461
|
+
}
|
462
|
+
const entryRenderConfList = entrys.map(info => {
|
377
463
|
return {
|
378
464
|
input: path__default["default"].join(templatePath, 'miniapp-page-manager.hbs'),
|
379
465
|
output: path__default["default"].join(mainPath, info.entryFilename),
|
@@ -385,12 +471,15 @@ function renderMiniprogramTemplate(opts) {
|
|
385
471
|
}
|
386
472
|
};
|
387
473
|
});
|
388
|
-
|
389
|
-
entryRenderConfList.concat(serviceRenderItem).forEach(config => {
|
474
|
+
entryRenderConfList.concat(renderConfigList).forEach(config => {
|
390
475
|
renderTemplate(config.input, config.output, config.data);
|
391
476
|
});
|
392
477
|
}
|
393
478
|
|
479
|
+
function initPlugins(pluginDriver) {
|
480
|
+
new InjectWebviewUrlParamsPlugin().apply(pluginDriver);
|
481
|
+
}
|
482
|
+
|
394
483
|
var httpsConf = {
|
395
484
|
cert: fs__default["default"].readFileSync(path__default["default"].join(staticPath, "./certs/cert.pem")),
|
396
485
|
key: fs__default["default"].readFileSync(path__default["default"].join(staticPath, "./certs/key.pem")),
|
@@ -435,17 +524,19 @@ function compress(output) {
|
|
435
524
|
});
|
436
525
|
}
|
437
526
|
|
527
|
+
// 36PX
|
438
528
|
async function makeBuildResults(mode, opts) {
|
439
529
|
const { baseURI, entrys, outputPath } = opts;
|
440
530
|
const releasePath = path__default["default"].join(outputPath, 'build-result');
|
441
531
|
const buildResultMap = {};
|
532
|
+
const paramsStr = makeWebviewUrlParamsStr();
|
442
533
|
const buildResultList = entrys.map(info => {
|
443
534
|
const result = {
|
444
535
|
type: 'HTML',
|
445
536
|
content: {
|
446
537
|
pages: [
|
447
538
|
{
|
448
|
-
path: getPagePath(info)
|
539
|
+
path: getPagePath(info, paramsStr)
|
449
540
|
}
|
450
541
|
],
|
451
542
|
baseURI
|
@@ -467,12 +558,12 @@ async function makeBuildResults(mode, opts) {
|
|
467
558
|
}
|
468
559
|
return buildResultMap;
|
469
560
|
}
|
470
|
-
function getPagePath(entryInfo) {
|
561
|
+
function getPagePath(entryInfo, extraParams) {
|
471
562
|
const extType = entryInfo.extType;
|
472
563
|
let entry = entryInfo.entryPath;
|
473
564
|
// 移动端需要补 __module_busi__
|
474
565
|
if (extType.endsWith('_h5')) {
|
475
|
-
entry += '?__module_busi__=kiwi-ExtSDK';
|
566
|
+
entry += '?__module_busi__=kiwi-ExtSDK' + extraParams;
|
476
567
|
}
|
477
568
|
return entry;
|
478
569
|
}
|
@@ -503,6 +594,7 @@ const getPublicIP = (config) => {
|
|
503
594
|
};
|
504
595
|
|
505
596
|
const supportedExtTypeSet = new Set([
|
597
|
+
"app_inner_h5",
|
506
598
|
'web_video_com',
|
507
599
|
'app_panel_h5',
|
508
600
|
'zs_anchor_panel_h5',
|
@@ -554,6 +646,17 @@ function getDevBaseURI(config) {
|
|
554
646
|
return `${protocol}://${config.host}:${config.port}/`;
|
555
647
|
}
|
556
648
|
|
649
|
+
function checkAppId(project) {
|
650
|
+
const appId = project.appId || project.appid;
|
651
|
+
if (appId == null || appId === '') {
|
652
|
+
logger.fatal('请填写正确的appid');
|
653
|
+
}
|
654
|
+
else if (appId.length > 10) {
|
655
|
+
logger.fatal('appid错误,请登录 https://ext.huya.com/ 在您的小程序概要中查看小程序ID');
|
656
|
+
}
|
657
|
+
return appId;
|
658
|
+
}
|
659
|
+
|
557
660
|
function mergePackage(projectConfig, outputPath, opts) {
|
558
661
|
logger.log('正在合并分包...');
|
559
662
|
const mergeMethod = projectConfig.compileType == 'game'
|
@@ -567,6 +670,10 @@ function getTempProjectDir(projectDir) {
|
|
567
670
|
return path__default["default"].join(tempDir, '.revues-projects', path__default["default"].basename(projectDir));
|
568
671
|
}
|
569
672
|
class RevueBuilder {
|
673
|
+
constructor() {
|
674
|
+
// 单例 PluginDriver 更加灵活
|
675
|
+
initPlugins(PluginDriver);
|
676
|
+
}
|
570
677
|
// 这里拿到打包好的代码 原样输出 + build result
|
571
678
|
async build(opts) {
|
572
679
|
const { inputPath, outputPath, publicPath, projectConfig, config, extUuid } = opts;
|
@@ -574,8 +681,9 @@ class RevueBuilder {
|
|
574
681
|
fs__default["default"].existsSync(outputPath) && fs__default["default"].removeSync(outputPath);
|
575
682
|
// 把 inputPath 的文件 迁移到 outputPath
|
576
683
|
await fs__default["default"].copy(inputPath, outputPath, { overwrite: true });
|
577
|
-
const entrys = mergePackage(projectConfig, outputPath, {
|
578
|
-
builderConfig: processedConfig
|
684
|
+
const { entrys } = mergePackage(projectConfig, outputPath, {
|
685
|
+
builderConfig: processedConfig,
|
686
|
+
extUuid
|
579
687
|
});
|
580
688
|
return await makeBuildResults('production', {
|
581
689
|
entrys: entrys,
|
@@ -585,37 +693,41 @@ class RevueBuilder {
|
|
585
693
|
}
|
586
694
|
async start(opts) {
|
587
695
|
const { debug, inputPath, projectConfig, outputPath: outputPath$1, config } = opts;
|
588
|
-
const outputPath = getTempProjectDir(path__default["default"].dirname(inputPath))
|
696
|
+
const outputPath = getTempProjectDir(path__default["default"].dirname(inputPath))
|
697
|
+
;
|
698
|
+
const appId = checkAppId(projectConfig);
|
589
699
|
const processedConfig = processBuilderConfigJSON('development', config);
|
590
700
|
if (projectConfig.compileType == 'game') {
|
591
701
|
await watchGame(inputPath, outputPath, () => {
|
592
702
|
mergePackage(projectConfig, outputPath, {
|
593
|
-
|
594
|
-
|
703
|
+
builderConfig: processedConfig,
|
704
|
+
watch: true
|
595
705
|
});
|
596
706
|
});
|
597
707
|
}
|
598
708
|
else {
|
599
709
|
await watch(inputPath, outputPath, () => {
|
600
710
|
mergePackage(projectConfig, outputPath, {
|
601
|
-
|
602
|
-
|
711
|
+
builderConfig: processedConfig,
|
712
|
+
watch: true
|
603
713
|
});
|
604
714
|
});
|
605
715
|
}
|
606
|
-
const entrys = mergePackage(projectConfig, outputPath, {
|
716
|
+
const { entrys, mainPublicPath } = mergePackage(projectConfig, outputPath, {
|
607
717
|
builderConfig: processedConfig,
|
718
|
+
extUuid: appId,
|
608
719
|
template: {
|
609
|
-
debug
|
720
|
+
debug,
|
721
|
+
dev: true
|
610
722
|
}
|
611
723
|
});
|
612
724
|
logger.log('启动 live server 服务...');
|
613
|
-
logger.success('本地访问地址:', getDevBaseURI(processedConfig) +
|
614
|
-
|
725
|
+
logger.success('本地访问地址:', getDevBaseURI(processedConfig) + entrys[0]?.entryPath);
|
726
|
+
logger.success('扫码预览地址:', getDevBaseURI(processedConfig) + mainPublicPath + '/remote-debugger.html');
|
615
727
|
startLiveServer({
|
616
728
|
...processedConfig,
|
617
729
|
root: outputPath,
|
618
|
-
ignore:
|
730
|
+
ignore: 'node_modules'
|
619
731
|
});
|
620
732
|
return await makeBuildResults('development', {
|
621
733
|
entrys,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hyext/builder-revues",
|
3
|
-
"version": "0.0.1-beta.
|
3
|
+
"version": "0.0.1-beta.19",
|
4
4
|
"description": "> TODO: description",
|
5
5
|
"author": "diamondloler <857276958@qq.com>",
|
6
6
|
"homepage": "",
|
@@ -22,11 +22,11 @@
|
|
22
22
|
},
|
23
23
|
"scripts": {},
|
24
24
|
"dependencies": {
|
25
|
-
"@revues/cocos-web-adapter": "0.0.1-beta.
|
26
|
-
"@revues/code-compiler": "0.0.1-beta.
|
27
|
-
"@revues/hyext-adapter": "0.0.1-beta.
|
28
|
-
"@revues/web-frame": "0.0.1-beta.
|
29
|
-
"@revues/web-sdk-core": "0.0.1-beta.
|
25
|
+
"@revues/cocos-web-adapter": "0.0.1-beta.19",
|
26
|
+
"@revues/code-compiler": "0.0.1-beta.19",
|
27
|
+
"@revues/hyext-adapter": "0.0.1-beta.19",
|
28
|
+
"@revues/web-frame": "0.0.1-beta.19",
|
29
|
+
"@revues/web-sdk-core": "0.0.1-beta.19",
|
30
30
|
"archiver": "^7.0.1",
|
31
31
|
"chalk": "^2.4.2",
|
32
32
|
"fs-extra": "8.1.0",
|
@@ -34,6 +34,7 @@
|
|
34
34
|
"handlebars": "^4.7.8",
|
35
35
|
"live-server": "^1.2.2",
|
36
36
|
"ramda": "^0.29.1",
|
37
|
+
"tapable": "^2.2.1",
|
37
38
|
"util": "^0.12.5"
|
38
39
|
},
|
39
40
|
"devDependencies": {
|
@@ -41,5 +42,5 @@
|
|
41
42
|
"@types/live-server": "^1.2.3",
|
42
43
|
"@types/ramda": "^0.29.11"
|
43
44
|
},
|
44
|
-
"gitHead": "
|
45
|
+
"gitHead": "467b64993d87fa2aa48440c32a3760a1617a8952"
|
45
46
|
}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en"><head>
|
3
|
+
<meta charset="UTF-8">
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
+
<title>扫码预览</title>
|
6
|
+
<script charset="UTF-8" src="https://cdnjs.cloudflare.com/ajax/libs/qrcode/1.5.1/qrcode.min.js"></script>
|
7
|
+
<style>
|
8
|
+
* {
|
9
|
+
box-sizing: border-box;
|
10
|
+
}
|
11
|
+
a {
|
12
|
+
color: blue;
|
13
|
+
}
|
14
|
+
body,html {
|
15
|
+
height: 100%;
|
16
|
+
width: 100%;
|
17
|
+
|
18
|
+
font-size: 16px;
|
19
|
+
color: #333;
|
20
|
+
}
|
21
|
+
body {
|
22
|
+
display: flex;
|
23
|
+
flex-direction: column;
|
24
|
+
flex: 1;
|
25
|
+
margin: 0;
|
26
|
+
position: relative;
|
27
|
+
}
|
28
|
+
.container {
|
29
|
+
display: flex;
|
30
|
+
flex-direction: column;
|
31
|
+
flex: 1;
|
32
|
+
justify-content: center;
|
33
|
+
align-items: center;
|
34
|
+
}
|
35
|
+
.title {
|
36
|
+
font-weight: bold;
|
37
|
+
}
|
38
|
+
.tip {
|
39
|
+
font-size: 14px;
|
40
|
+
line-height: 26px;
|
41
|
+
}
|
42
|
+
</style>
|
43
|
+
</head>
|
44
|
+
|
45
|
+
<body>
|
46
|
+
<div class="container">
|
47
|
+
<canvas id="canvas"></canvas>
|
48
|
+
<span class="title">扫码调试</span>
|
49
|
+
<span class="tip">如未绑定全局小程序下发,请先<a href="">绑定</a></span>
|
50
|
+
<span class="tip">如需查看 vconsole, 可在 project.config.json 把 debug 字段设置为 true 或在 cocos ide 打包时勾上调试选项</a></span>
|
51
|
+
</div>
|
52
|
+
<script>
|
53
|
+
var url = 'https://m.huya.com?hyaction=hyminiprogram&extuuid={{ extUuid }}{{paramsStr}}'
|
54
|
+
var canvas = document.getElementById('canvas')
|
55
|
+
QRCode.toCanvas(canvas, url, {width: 200}, function (error) {
|
56
|
+
if (error) console.error(error)
|
57
|
+
console.log('success!');
|
58
|
+
})
|
59
|
+
</script>
|
60
|
+
</body>
|
61
|
+
</html>
|