diff --git a/package.json b/package.json index 3aab9fd07..ff70d176d 100644 --- a/package.json +++ b/package.json @@ -61,8 +61,8 @@ "devDependencies": { "@vant/cli": "^3.10.9", "@vant/area-data": "^1.1.1", - "@vue/compiler-sfc": "^3.1.1", - "vue": "^3.1.1" + "@vue/compiler-sfc": "^3.1.3", + "vue": "^3.1.3" }, "sideEffects": [ "es/**/style/*", diff --git a/src/config-provider/ConfigProvider.tsx b/src/config-provider/ConfigProvider.tsx index d1e064cb3..8df5ee949 100644 --- a/src/config-provider/ConfigProvider.tsx +++ b/src/config-provider/ConfigProvider.tsx @@ -23,6 +23,10 @@ export default defineComponent({ props: { themeVars: Object as PropType>, + tag: { + type: String as PropType, + default: 'div', + }, }, setup(props, { slots }) { @@ -33,9 +37,9 @@ export default defineComponent({ }); return () => ( -
+ {slots.default?.()} -
+ ); }, }); diff --git a/src/config-provider/README.md b/src/config-provider/README.md index 36985dd8d..93a67fe76 100644 --- a/src/config-provider/README.md +++ b/src/config-provider/README.md @@ -195,6 +195,7 @@ There are some **Basic Variables** below, for component CSS Variables, please re ### Props -| Attribute | Description | Type | Default | -| ---------- | --------------- | -------- | ------- | -| theme-vars | Theme variables | _object_ | - | +| Attribute | Description | Type | Default | +| ------------ | ------------------------ | -------- | ------- | +| theme-vars | Theme variables | _object_ | - | +| tag `v3.1.2` | HTML Tag of root element | _string_ | `div` | diff --git a/src/config-provider/README.zh-CN.md b/src/config-provider/README.zh-CN.md index ec61bf3de..d594548c5 100644 --- a/src/config-provider/README.zh-CN.md +++ b/src/config-provider/README.zh-CN.md @@ -195,6 +195,7 @@ export default { ### Props -| 参数 | 说明 | 类型 | 默认值 | -| ---------- | -------------- | -------- | ------ | -| theme-vars | 自定义主题变量 | _object_ | - | +| 参数 | 说明 | 类型 | 默认值 | +| ------------ | ------------------------ | -------- | ------ | +| theme-vars | 自定义主题变量 | _object_ | - | +| tag `v3.1.2` | 根节点对应的 HTML 标签名 | _string_ | `div` | diff --git a/src/config-provider/test/__snapshots__/index.spec.ts.snap b/src/config-provider/test/__snapshots__/index.spec.ts.snap new file mode 100644 index 000000000..b481a936f --- /dev/null +++ b/src/config-provider/test/__snapshots__/index.spec.ts.snap @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render tag prop correctly 1`] = ` +
+
+`; diff --git a/src/config-provider/test/index.spec.ts b/src/config-provider/test/index.spec.ts new file mode 100644 index 000000000..86b0c3ddd --- /dev/null +++ b/src/config-provider/test/index.spec.ts @@ -0,0 +1,11 @@ +import { ConfigProvider } from '..'; +import { mount } from '../../../test'; + +test('should render tag prop correctly', () => { + const wrapper = mount(ConfigProvider, { + props: { + tag: 'section', + }, + }); + expect(wrapper.html()).toMatchSnapshot(); +}); diff --git a/yarn.lock b/yarn.lock index bab748077..72818f415 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1565,6 +1565,11 @@ resolved "https://registry.nlark.com/@types/estree/download/@types/estree-0.0.47.tgz?cache=0&sync_timestamp=1622611989122&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Festree%2Fdownload%2F%40types%2Festree-0.0.47.tgz#d7a51db20f0650efec24cd04994f523d93172ed4" integrity sha1-16Udsg8GUO/sJM0EmU9SPZMXLtQ= +"@types/estree@^0.0.48": + version "0.0.48" + resolved "https://registry.nlark.com/@types/estree/download/@types/estree-0.0.48.tgz#18dc8091b285df90db2f25aa7d906cfc394b7f74" + integrity sha1-GNyAkbKF35DbLyWqfZBs/DlLf3Q= + "@types/express-serve-static-core@*": version "4.17.13" resolved "https://registry.npm.taobao.org/@types/express-serve-static-core/download/@types/express-serve-static-core-4.17.13.tgz?cache=0&sync_timestamp=1605053364166&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fexpress-serve-static-core%2Fdownload%2F%40types%2Fexpress-serve-static-core-4.17.13.tgz#d9af025e925fc8b089be37423b8d1eac781be084" @@ -2035,36 +2040,37 @@ html-tags "^3.1.0" svg-tags "^1.0.0" -"@vue/compiler-core@3.1.1": - version "3.1.1" - resolved "https://registry.nlark.com/@vue/compiler-core/download/@vue/compiler-core-3.1.1.tgz#4f2c5d70eabd454675714cc8bd2b97f6a8efb196" - integrity sha1-TyxdcOq9RUZ1cUzIvSuX9qjvsZY= +"@vue/compiler-core@3.1.3": + version "3.1.3" + resolved "https://registry.nlark.com/@vue/compiler-core/download/@vue/compiler-core-3.1.3.tgz?cache=0&sync_timestamp=1625182909191&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40vue%2Fcompiler-core%2Fdownload%2F%40vue%2Fcompiler-core-3.1.3.tgz#cd9587aa1fda533b1bdf752689e281efccfb7062" + integrity sha1-zZWHqh/aUzsb33UmieKB78z7cGI= dependencies: "@babel/parser" "^7.12.0" "@babel/types" "^7.12.0" - "@vue/shared" "3.1.1" + "@vue/shared" "3.1.3" estree-walker "^2.0.1" source-map "^0.6.1" -"@vue/compiler-dom@3.1.1": - version "3.1.1" - resolved "https://registry.nlark.com/@vue/compiler-dom/download/@vue/compiler-dom-3.1.1.tgz#ef60d856ac2ede5b2ad5c72a7a68122895e3d652" - integrity sha1-72DYVqwu3lsq1ccqemgSKJXj1lI= +"@vue/compiler-dom@3.1.3": + version "3.1.3" + resolved "https://registry.nlark.com/@vue/compiler-dom/download/@vue/compiler-dom-3.1.3.tgz?cache=0&sync_timestamp=1625182908685&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40vue%2Fcompiler-dom%2Fdownload%2F%40vue%2Fcompiler-dom-3.1.3.tgz#ade4ff7db4b0a197c543dd67b5bd467d737ac344" + integrity sha1-reT/fbSwoZfFQ91ntb1GfXN6w0Q= dependencies: - "@vue/compiler-core" "3.1.1" - "@vue/shared" "3.1.1" + "@vue/compiler-core" "3.1.3" + "@vue/shared" "3.1.3" -"@vue/compiler-sfc@^3.1.1": - version "3.1.1" - resolved "https://registry.nlark.com/@vue/compiler-sfc/download/@vue/compiler-sfc-3.1.1.tgz#d4e4507c013d0b219f0b106b317ec5bb1cde3398" - integrity sha1-1ORQfAE9CyGfCxBrMX7FuxzeM5g= +"@vue/compiler-sfc@^3.1.3": + version "3.1.3" + resolved "https://registry.nlark.com/@vue/compiler-sfc/download/@vue/compiler-sfc-3.1.3.tgz#f8aba30e5254a2b7be9516159630c8f75b412216" + integrity sha1-+KujDlJUore+lRYVljDI91tBIhY= dependencies: "@babel/parser" "^7.13.9" "@babel/types" "^7.13.0" - "@vue/compiler-core" "3.1.1" - "@vue/compiler-dom" "3.1.1" - "@vue/compiler-ssr" "3.1.1" - "@vue/shared" "3.1.1" + "@types/estree" "^0.0.48" + "@vue/compiler-core" "3.1.3" + "@vue/compiler-dom" "3.1.3" + "@vue/compiler-ssr" "3.1.3" + "@vue/shared" "3.1.3" consolidate "^0.16.0" estree-walker "^2.0.1" hash-sum "^2.0.0" @@ -2076,42 +2082,42 @@ postcss-selector-parser "^6.0.4" source-map "^0.6.1" -"@vue/compiler-ssr@3.1.1": - version "3.1.1" - resolved "https://registry.nlark.com/@vue/compiler-ssr/download/@vue/compiler-ssr-3.1.1.tgz#1d08b98601397258ed059b75966e0e94a385d770" - integrity sha1-HQi5hgE5cljtBZt1lm4OlKOF13A= +"@vue/compiler-ssr@3.1.3": + version "3.1.3" + resolved "https://registry.nlark.com/@vue/compiler-ssr/download/@vue/compiler-ssr-3.1.3.tgz?cache=0&sync_timestamp=1625183310009&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40vue%2Fcompiler-ssr%2Fdownload%2F%40vue%2Fcompiler-ssr-3.1.3.tgz#e74394b031f6956710f1881e21fa9fe1fa5a030e" + integrity sha1-50OUsDH2lWcQ8YgeIfqf4fpaAw4= dependencies: - "@vue/compiler-dom" "3.1.1" - "@vue/shared" "3.1.1" + "@vue/compiler-dom" "3.1.3" + "@vue/shared" "3.1.3" -"@vue/reactivity@3.1.1": - version "3.1.1" - resolved "https://registry.nlark.com/@vue/reactivity/download/@vue/reactivity-3.1.1.tgz#9c02fd146a6c3b03e7d658b7cf76f4b69b0f98c8" - integrity sha1-nAL9FGpsOwPn1li3z3b0tpsPmMg= +"@vue/reactivity@3.1.3": + version "3.1.3" + resolved "https://registry.nlark.com/@vue/reactivity/download/@vue/reactivity-3.1.3.tgz?cache=0&sync_timestamp=1625182286830&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40vue%2Freactivity%2Fdownload%2F%40vue%2Freactivity-3.1.3.tgz#0aa4dfbac33f1fa296b9436042e5cbd3d84eeb46" + integrity sha1-CqTfusM/H6KWuUNgQuXL09hO60Y= dependencies: - "@vue/shared" "3.1.1" + "@vue/shared" "3.1.3" -"@vue/runtime-core@3.1.1": - version "3.1.1" - resolved "https://registry.nlark.com/@vue/runtime-core/download/@vue/runtime-core-3.1.1.tgz#542110c09a643d7d80646a2f071aff6b324c4158" - integrity sha1-VCEQwJpkPX2AZGovBxr/azJMQVg= +"@vue/runtime-core@3.1.3": + version "3.1.3" + resolved "https://registry.nlark.com/@vue/runtime-core/download/@vue/runtime-core-3.1.3.tgz#8524f6e965aba3a94ae30ded715f13ec6be59c46" + integrity sha1-hST26WWro6lK4w3tcV8T7GvlnEY= dependencies: - "@vue/reactivity" "3.1.1" - "@vue/shared" "3.1.1" + "@vue/reactivity" "3.1.3" + "@vue/shared" "3.1.3" -"@vue/runtime-dom@3.1.1": - version "3.1.1" - resolved "https://registry.nlark.com/@vue/runtime-dom/download/@vue/runtime-dom-3.1.1.tgz#5539bbce132d29f6445b4964cb7b4164a89a5ce6" - integrity sha1-VTm7zhMtKfZEW0lky3tBZKiaXOY= +"@vue/runtime-dom@3.1.3": + version "3.1.3" + resolved "https://registry.nlark.com/@vue/runtime-dom/download/@vue/runtime-dom-3.1.3.tgz?cache=0&sync_timestamp=1625183312585&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40vue%2Fruntime-dom%2Fdownload%2F%40vue%2Fruntime-dom-3.1.3.tgz#cb1c218564892db0705ce9576b39e50f820b27b8" + integrity sha1-yxwhhWSJLbBwXOlXaznlD4ILJ7g= dependencies: - "@vue/runtime-core" "3.1.1" - "@vue/shared" "3.1.1" + "@vue/runtime-core" "3.1.3" + "@vue/shared" "3.1.3" csstype "^2.6.8" -"@vue/shared@3.1.1": - version "3.1.1" - resolved "https://registry.nlark.com/@vue/shared/download/@vue/shared-3.1.1.tgz#2287cfc3dc20e5b20aeb65c2c3a56533bdca801c" - integrity sha1-IofPw9wg5bIK62XCw6VlM73KgBw= +"@vue/shared@3.1.3": + version "3.1.3" + resolved "https://registry.nlark.com/@vue/shared/download/@vue/shared-3.1.3.tgz?cache=0&sync_timestamp=1625182288628&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40vue%2Fshared%2Fdownload%2F%40vue%2Fshared-3.1.3.tgz#3f6f5e7226d8d2d965ef39780ae3f89dc906b5fc" + integrity sha1-P29ecibY0tll7zl4CuP4nckGtfw= "@vue/test-utils@2.0.0-rc.6": version "2.0.0-rc.6" @@ -10886,14 +10892,14 @@ vue-router@^4.0.0: resolved "https://registry.npm.taobao.org/vue-router/download/vue-router-4.0.4.tgz?cache=0&sync_timestamp=1613740744184&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-router%2Fdownload%2Fvue-router-4.0.4.tgz#ad9b4b7bbdad622407b4ff189b1646f48c1e9053" integrity sha1-rZtLe72tYiQHtP8YmxZG9IwekFM= -vue@^3.1.1: - version "3.1.1" - resolved "https://registry.nlark.com/vue/download/vue-3.1.1.tgz#9ad655758a0fa6c0dee5b3d2431d3912a9b381aa" - integrity sha1-mtZVdYoPpsDe5bPSQx05Eqmzgao= +vue@^3.1.3: + version "3.1.3" + resolved "https://registry.nlark.com/vue/download/vue-3.1.3.tgz?cache=0&sync_timestamp=1625182289257&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fvue%2Fdownload%2Fvue-3.1.3.tgz#8659cdcd18bae0fc0aa79ddde6594c1e0b2facae" + integrity sha1-hlnNzRi64PwKp53d5llMHgsvrK4= dependencies: - "@vue/compiler-dom" "3.1.1" - "@vue/runtime-dom" "3.1.1" - "@vue/shared" "3.1.1" + "@vue/compiler-dom" "3.1.3" + "@vue/runtime-dom" "3.1.3" + "@vue/shared" "3.1.3" w3c-hr-time@^1.0.2: version "1.0.2"