Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/vant-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@rsbuild/plugin-sass": "^1.5.2",
"@rsbuild/plugin-vue": "^1.2.7",
"@rsbuild/plugin-vue-jsx": "^2.0.0",
"vue-jsx-vapor": "3.2.13",
"@vant/touch-emulator": "workspace:^",
"@vitejs/plugin-vue": "^5.2.4",
"@vitejs/plugin-vue-jsx": "^4.2.0",
Expand Down
6 changes: 4 additions & 2 deletions packages/vant-cli/src/compiler/compile-site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export async function compileSite(isProd = false) {

const { createRsbuild } = await import('@rsbuild/core');
const { pluginVue } = await import('@rsbuild/plugin-vue');
const { pluginVueJsx } = await import('@rsbuild/plugin-vue-jsx');
const { default: pluginVueJsx } = await import('vue-jsx-vapor/rsbuild');
const { pluginBabel } = await import('@rsbuild/plugin-babel');
const { pluginSass } = await import('@rsbuild/plugin-sass');
const { pluginLess } = await import('@rsbuild/plugin-less');
Expand All @@ -58,7 +58,9 @@ export async function compileSite(isProd = false) {
exclude: /[\\/]node_modules[\\/]/,
}),
pluginVue(),
pluginVueJsx(),
pluginVueJsx({
interop: true,
}),
pluginSass(),
pluginLess(),
],
Expand Down
1 change: 1 addition & 0 deletions packages/vant/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"typescript": "^5.9.3",
"rstest-canvas-mock": "^0.0.5",
"vue": "^3.5.33",
"vue-jsx-vapor": "3.2.13",
"vue-router": "^5.0.6"
Comment on lines 70 to 74
},
"sideEffects": [
Expand Down
9 changes: 7 additions & 2 deletions packages/vant/rstest.config.mts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import { defineConfig, type ProjectConfig } from '@rstest/core';
import { pluginBabel } from '@rsbuild/plugin-babel';
import { pluginVue } from '@rsbuild/plugin-vue';
import { pluginVueJsx } from '@rsbuild/plugin-vue-jsx';
import vueJsxCompiler from 'vue-jsx-vapor/rsbuild';

const commonConfig: ProjectConfig = {
plugins: [
pluginBabel({
include: /\.(?:jsx|tsx)$/,
}),
pluginVueJsx(),
vueJsxCompiler({
interop: true,
compiler: {
runtimeModuleName: 'vue-jsx-vapor', // for SSR tests
},
}),
pluginVue(),
],
globals: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<!--[-->
</div>
<!--[-->
Icon1
</div>
<div
Expand All @@ -30,6 +31,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<!--[-->
</div>
<!--[-->
Icon2
</div>
<div
Expand All @@ -43,6 +45,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<!--[-->
</div>
<!--[-->
Icon3
</div>
<button
Expand All @@ -52,6 +55,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<div class="van-button__content">
<span class="van-button__text">
<!--[-->
<!--[-->
Button
</span>
Expand Down Expand Up @@ -79,6 +83,7 @@ exports[`should render demo and match snapshot 1`] = `
>
</div>
</div>
<!--[-->
Icon1
</div>
<div
Expand All @@ -98,6 +103,7 @@ exports[`should render demo and match snapshot 1`] = `
5
</div>
</div>
<!--[-->
Icon2
</div>
<div
Expand All @@ -117,6 +123,7 @@ exports[`should render demo and match snapshot 1`] = `
12
</div>
</div>
<!--[-->
Icon3
</div>
<button
Expand All @@ -126,6 +133,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<div class="van-button__content">
<span class="van-button__text">
<!--[-->
<!--[-->
Button
</span>
Expand All @@ -138,6 +146,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<div class="van-button__content">
<span class="van-button__text">
<!--[-->
<!--[-->
Button
</span>
Expand All @@ -160,6 +169,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<!--[-->
</div>
<!--[-->
Icon1
</div>
<div
Expand All @@ -173,6 +183,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<!--[-->
</div>
<!--[-->
Icon2
</div>
<div
Expand All @@ -186,6 +197,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<!--[-->
</div>
<!--[-->
Collected
</div>
<button
Expand All @@ -195,6 +207,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<div class="van-button__content">
<span class="van-button__text">
<!--[-->
<!--[-->
Button
</span>
Expand All @@ -207,6 +220,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<div class="van-button__content">
<span class="van-button__text">
<!--[-->
<!--[-->
Button
</span>
Expand All @@ -229,6 +243,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<!--[-->
</div>
<!--[-->
Icon1
</div>
<div
Expand All @@ -242,6 +257,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<!--[-->
</div>
<!--[-->
Icon2
</div>
<button
Expand All @@ -251,6 +267,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<div class="van-button__content">
<span class="van-button__text">
<!--[-->
<!--[-->
Button
</span>
Expand All @@ -263,6 +280,7 @@ exports[`should render demo and match snapshot 1`] = `
>
<div class="van-button__content">
<span class="van-button__text">
<!--[-->
<!--[-->
Button
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ exports[`should render demo and match snapshot 1`] = `
</label>
</div>
<div class="van-cell__value van-field__value">
<!--[-->
<!--[-->
<div class="van-field__body">
<input
Expand Down Expand Up @@ -51,6 +52,7 @@ exports[`should render demo and match snapshot 1`] = `
</label>
</div>
<div class="van-cell__value van-field__value">
<!--[-->
<!--[-->
<div class="van-field__body">
<input
Expand Down Expand Up @@ -84,6 +86,7 @@ exports[`should render demo and match snapshot 1`] = `
</label>
</div>
<div class="van-cell__value van-field__value">
<!--[-->
<!--[-->
<div class="van-field__body">
<input
Expand Down Expand Up @@ -121,6 +124,7 @@ exports[`should render demo and match snapshot 1`] = `
</label>
</div>
<div class="van-cell__value van-field__value">
<!--[-->
<!--[-->
<div class="van-field__body">
<textarea
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ exports[`should render demo and match snapshot 1`] = `
class="van-radio__icon van-radio__icon--round van-radio__icon--checked"
style="font-size:18px;"
>
<!--[-->
<i
class="van-badge__wrapper van-icon van-icon-success"
style
Expand Down Expand Up @@ -81,6 +82,7 @@ exports[`should render demo and match snapshot 1`] = `
class="van-radio__icon van-radio__icon--round"
style="font-size:18px;"
>
<!--[-->
<i
class="van-badge__wrapper van-icon van-icon-success"
style
Expand Down
16 changes: 16 additions & 0 deletions packages/vant/src/area/test/__snapshots__/demo-ssr.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ exports[`should render demo and match snapshot 1`] = `
<div>
<!--[-->
<div class="van-picker van-area">
<!--[-->
<div class="van-picker__toolbar">
<!--[-->
<!--[-->
<button
type="button"
class="van-picker__cancel van-haptics-feedback"
>
<!--[-->
Cancel
</button>
<div class="van-picker__title van-ellipsis">
Expand All @@ -20,6 +23,7 @@ exports[`should render demo and match snapshot 1`] = `
type="button"
class="van-picker__confirm van-haptics-feedback"
>
<!--[-->
Confirm
</button>
</div>
Expand Down Expand Up @@ -209,12 +213,15 @@ exports[`should render demo and match snapshot 1`] = `
<div>
<!--[-->
<div class="van-picker van-area">
<!--[-->
<div class="van-picker__toolbar">
<!--[-->
<!--[-->
<button
type="button"
class="van-picker__cancel van-haptics-feedback"
>
<!--[-->
Cancel
</button>
<div class="van-picker__title van-ellipsis">
Expand All @@ -224,6 +231,7 @@ exports[`should render demo and match snapshot 1`] = `
type="button"
class="van-picker__confirm van-haptics-feedback"
>
<!--[-->
Confirm
</button>
</div>
Expand Down Expand Up @@ -403,12 +411,15 @@ exports[`should render demo and match snapshot 1`] = `
<div>
<!--[-->
<div class="van-picker van-area">
<!--[-->
<div class="van-picker__toolbar">
<!--[-->
<!--[-->
<button
type="button"
class="van-picker__cancel van-haptics-feedback"
>
<!--[-->
Cancel
</button>
<div class="van-picker__title van-ellipsis">
Expand All @@ -418,6 +429,7 @@ exports[`should render demo and match snapshot 1`] = `
type="button"
class="van-picker__confirm van-haptics-feedback"
>
<!--[-->
Confirm
</button>
</div>
Expand Down Expand Up @@ -499,12 +511,15 @@ exports[`should render demo and match snapshot 1`] = `
<div>
<!--[-->
<div class="van-picker van-area">
<!--[-->
<div class="van-picker__toolbar">
<!--[-->
<!--[-->
<button
type="button"
class="van-picker__cancel van-haptics-feedback"
>
<!--[-->
Cancel
</button>
<div class="van-picker__title van-ellipsis">
Expand All @@ -514,6 +529,7 @@ exports[`should render demo and match snapshot 1`] = `
type="button"
class="van-picker__confirm van-haptics-feedback"
>
<!--[-->
Confirm
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

exports[`should render demo and match snapshot 1`] = `
<div class="van-tabs van-tabs--line">
<!--[-->
<!--[-->
<!--[-->
<div class="van-tabs__wrap">
<div
Expand Down
5 changes: 2 additions & 3 deletions packages/vant/src/badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,11 @@ export default defineComponent({

return () => {
if (slots.default) {
const { tag } = props;
return (
<tag class={bem('wrapper')}>
<props.tag class={bem('wrapper')}>
{slots.default()}
{renderBadge()}
</tag>
</props.tag>
);
}

Expand Down
5 changes: 2 additions & 3 deletions packages/vant/src/button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ export default defineComponent({

return () => {
const {
tag,
type,
size,
block,
Expand Down Expand Up @@ -177,7 +176,7 @@ export default defineComponent({
];

return (
<tag
<props.tag
type={nativeType}
class={classes}
style={getStyle()}
Expand All @@ -189,7 +188,7 @@ export default defineComponent({
{renderText()}
{iconPosition === 'right' && renderIcon()}
</div>
</tag>
</props.tag>
);
};
},
Expand Down
Loading