fix(微信视频号组件): 宏导致的H5环境编译出错
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<template>
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<view class="diy-wechat-channel" :style="channelWarpCss">
|
||||
<view class="channel-header" @tap="handlerClick">
|
||||
<image class="channel-avatar" :src="$util.img(value.avatarUrl)" mode="aspectFill"></image>
|
||||
@@ -9,7 +10,6 @@
|
||||
<image class="channel-arrow" :src="$util.img('addon/personnel/shop/view/enterprise/arrow.png')" mode="aspectFill"></image>
|
||||
</view>
|
||||
<!-- 嵌入式视频播放 -->
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<native-component v-if="value.embedMode && typeof wx !== 'undefined' && wx.canIUse('component.channel-video')">
|
||||
<channel-video
|
||||
:feed-id="value.feedId"
|
||||
@@ -18,7 +18,6 @@
|
||||
style="width: 100%; height: 320rpx;">
|
||||
</channel-video>
|
||||
</native-component>
|
||||
<!-- #endif -->
|
||||
<!-- 跳转式视频播放 -->
|
||||
<view v-else class="channel-video" @tap="playVideo">
|
||||
<image class="video-cover" :src="$util.img(value.coverUrl)" mode="aspectFill"></image>
|
||||
@@ -33,8 +32,10 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
// 微信视频号组件
|
||||
import DiyMinx from './minx.js'
|
||||
|
||||
62
scripts/clean-empty-directories.js
Normal file
62
scripts/clean-empty-directories.js
Normal file
@@ -0,0 +1,62 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
/**
|
||||
* 递归删除空目录
|
||||
* @param {string} dirPath - 要检查的目录路径
|
||||
* @param {boolean} dryRun - 是否只打印不删除
|
||||
*/
|
||||
function removeEmptyDirectories(dirPath, dryRun = false) {
|
||||
try {
|
||||
// 读取目录内容
|
||||
const files = fs.readdirSync(dirPath);
|
||||
|
||||
// 递归检查子目录
|
||||
for (const file of files) {
|
||||
const fullPath = path.join(dirPath, file);
|
||||
const stat = fs.statSync(fullPath);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
removeEmptyDirectories(fullPath, dryRun);
|
||||
}
|
||||
}
|
||||
|
||||
// 再次读取目录内容,因为子目录可能已经被删除
|
||||
const updatedFiles = fs.readdirSync(dirPath);
|
||||
|
||||
// 如果目录为空
|
||||
if (updatedFiles.length === 0) {
|
||||
console.log(`${dryRun ? 'Would remove' : 'Removing'} empty directory: ${dirPath}`);
|
||||
if (!dryRun) {
|
||||
fs.rmdirSync(dirPath);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error processing directory ${dirPath}:`, error.message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 主函数
|
||||
*/
|
||||
function main() {
|
||||
// 获取项目根目录
|
||||
const projectRoot = path.resolve(__dirname, '..');
|
||||
|
||||
console.log('Starting to remove empty directories...');
|
||||
console.log(`Project root: ${projectRoot}`);
|
||||
console.log('====================================');
|
||||
|
||||
// 执行删除操作
|
||||
removeEmptyDirectories(projectRoot);
|
||||
|
||||
console.log('====================================');
|
||||
console.log('Empty directory cleanup completed!');
|
||||
}
|
||||
|
||||
// 运行主函数
|
||||
if (require.main === module) {
|
||||
main();
|
||||
}
|
||||
|
||||
module.exports = removeEmptyDirectories;
|
||||
Reference in New Issue
Block a user