We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
@nutui/nutui-taro
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: {},
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")); };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
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 = {
![bug](https://private-user-images.githubusercontent.com/16540863/338518192-3e409c78-be15-4041-823d-eca314e53c7c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjExMzUxNDQsIm5iZiI6MTcyMTEzNDg0NCwicGF0aCI6Ii8xNjU0MDg2My8zMzg1MTgxOTItM2U0MDljNzgtYmUxNS00MDQxLTgyM2QtZWNhMzE0ZTUzYzdjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE2VDEzMDA0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFhMWE4MzgzMGI3NGM5ODM4ZmYxMWJlOTZhYzExMDIwNTFmOGNlZTM1ZWYxMDY3MDMyODdmYmMwMGFjNGY2ZjMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.a0GnWmvgyBvB25TxAc8WRbZtXPPEnh_tpprD2RTx5u0)
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: {},
},
};
module.exports = function (merge) {
if (process.env.NODE_ENV === "development") {
return merge({}, config, require("./dev"));
}
return merge({}, config, require("./prod"));
};
其他补充信息
The text was updated successfully, but these errors were encountered: