Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用cell <nut-cell title="Icon Slot" desc="Description"> <template #icon> <My /> </template> </nut-cell> 该图标插槽无法使用,图标非插槽时可以使用 #3099

Open
scl930227 opened this issue Jun 11, 2024 · 0 comments

Comments

@scl930227
Copy link

NutUI 包名

@nutui/nutui-taro

NutUI 版本号

4.3.9

平台

h5, weapp

重现链接

/暂无

重现步骤

如题,正常tarojs+vue3+pina+ts 初始模板

期望的结果是什么?

可以cell插槽中icon 可以生效

实际的结果是什么?

可以cell插槽中icon 不生效

环境信息

// /config/index.ts
import path from "path";
import ComponentsPlugin from "unplugin-vue-components/webpack";
import NutUIResolver from "@nutui/auto-import-resolver";
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { UnifiedWebpackPluginV5 } = require("weapp-tailwindcss/webpack");

// 修改的文件:config/index.js
let env = process.env.TARO_ENV; //编译时环境
let outputRoot = "";
switch (env) {
case "weapp":
outputRoot = "dist";
break;
case "h5":
outputRoot = "dist_h5";
break;
case "alipay":
outputRoot = "dist_alipay";
break;
case "tt":
outputRoot = "dist_tt";
break;
default:
outputRoot = "dist";
}

const config = {
projectName: "red-property-webend",
date: "2024-6-4",
alias: {
"@": path.resolve(__dirname, "..", "src"),
"@components": path.resolve(__dirname, "..", "src/components"),
"@store": path.resolve(__dirname, "..", "src/components"),
"@pages": path.resolve(_dirname, "..", "src/pages"),
"@utils": path.resolve(dirname, "..", "src/utils"),
"@api": path.resolve(dirname, "..", "src/api"),
},
designWidth(input) {
// 配置 NutUI 375 尺寸
if (input?.file?.replace(/\+/g, "/").indexOf("@nutui") > -1) {
return 375;
}
// 全局使用 Taro 默认的 750 尺寸
return 750;
},
deviceRatio: {
640: 2.34 / 2,
750: 1,
828: 1.81 / 2,
375: 2 / 1,
},
sourceRoot: "src",
outputRoot: outputRoot,
// 开启 HTML 插件
plugins: ["@tarojs/plugin-html"],
defineConstants: {},
copy: {
patterns: [],
options: {},
},
framework: "vue3",
// 每次编译时提示警报:WARNING in external "taro_app_library@/remoteEntry.js NervJS/taro#15413
compiler: {
type: "webpack5",
prebundle: {
// 是否开启依赖预编译功能
enable: false,
},
},
cache: {
enable: false, // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
},
mini: {
webpackChain(chain, webpack) {
chain.plugin("unplugin-vue-components").use(
ComponentsPlugin({
resolvers: [NutUIResolver({ taro: true })],
})
);
chain.merge({
plugin: {
install: {
plugin: UnifiedWebpackPluginV5,
args: [
{
appType: "taro",
injectAdditionalCssVarScope: true,
// rem2rpx: true,
},
],
},
},
module: {
rule: {
mjsScript: {
test: /.mjs$/,
include: [/pinia/],
use: {
babelLoader: {
loader: require.resolve("babel-loader"),
},
},
},
},
},
});
},
postcss: {
tailwindcss: {},
pxtransform: {
enable: true,
config: {},
},
url: {
enable: true,
config: {
limit: 1024, // 设定转换尺寸上限
},
},
cssModules: {
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
config: {
namingPattern: "module", // 转换模式,取值为 global/module
generateScopedName: "[name][local]
[hash:base64:5]",
},
},
},
miniCssExtractPluginOption:{
ignoreOrder: true
}
},
h5: {
publicPath: "/",
staticDirectory: "static",
webpackChain(chain) {
chain.plugin("unplugin-vue-components").use(
ComponentsPlugin({
resolvers: [NutUIResolver({ taro: true })],
})
),
chain.plugin("htmlWebpackPlugin").tap((args) => {
args[0].templateParameters = {
...args[0].templateParameters,
projectName: "",
};
return args;
});
},
postcss: {
tailwindcss: {},
bug

  autoprefixer: {
    enable: true,
    config: {},
  },
  cssModules: {
    enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
    config: {
      namingPattern: "module", // 转换模式,取值为 global/module
      generateScopedName: "[name]__[local]___[hash:base64:5]",
    },
  },
},

},
};

module.exports = function (merge) {
if (process.env.NODE_ENV === "development") {
return merge({}, config, require("./dev"));
}
return merge({}, config, require("./prod"));
};

其他补充信息

Uploading bug.png…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant