Compare commits

...

11 Commits

Author SHA1 Message Date
neverland
bd609e1df0
perf: add truthProp util (#8522)
* perf: add TruthyProp util

* chore: rename

* chore: upd
2021-04-14 10:26:21 +08:00
neverland
9381640d2e
chore: improve calendar utils (#8521) 2021-04-14 10:16:02 +08:00
chenjiahan
35edb72b5c feat(Badge): offset prop support custom unit 2021-04-14 09:35:08 +08:00
chenjiahan
2be579975a chore(Button): improve code 2021-04-14 09:35:08 +08:00
chenjiahan
3224a8978f docs(Waterfall): add deprecation tip 2021-04-14 09:35:08 +08:00
chenjiahan
e38c5d27e0 chore: remove friendly-errors-webpack-plugin 2021-04-14 09:35:08 +08:00
chenjiahan
0e80000339 chore(cli): lock prettier version to 2.1.0 2021-04-14 09:35:08 +08:00
chenjiahan
5ac2033e2d chore(cli): remove @babel/plugin-transform-runtime 2021-04-14 09:35:08 +08:00
chenjiahan
93559a5741 chore(@vant/popperjs): remove @babel/runtime 2021-04-14 09:35:08 +08:00
chenjiahan
9c5ad689eb chore(@vant/lazyload): remove @babel/runtime 2021-04-14 09:35:08 +08:00
chenjiahan
7bfceb508e chore(@vant/use): remove @babel/runtime 2021-04-14 09:35:08 +08:00
89 changed files with 335 additions and 687 deletions

View File

@ -1,12 +1,14 @@
{
"root": true,
"extends": ["@vant"],
"rules": {
"prefer-object-spread": "off"
},
"overrides": [
{
"files": ["src/**/*"],
"excludedFiles": ["**/test/*", "**/demo/*"],
"rules": {
"prefer-object-spread": "off",
// since we target ES2015 for baseline support, we need to forbid object
// rest spread usage (both assign and destructure)
"no-restricted-syntax": [

View File

@ -63,7 +63,6 @@
"@vant/cli": "^3.10.0",
"@vant/area-data": "^1.0.0",
"@vue/compiler-sfc": "^3.0.6",
"prettier": "2.1.0",
"vue": "^3.0.6"
},
"sideEffects": [

View File

@ -292,24 +292,11 @@ module.exports = {
- @babel/preset-env不含 core-js
- @babel/preset-typescript
- @babel/plugin-transform-runtime
- @babel/plugin-transform-object-assign
- @babel/plugin-proposal-optional-chaining
- @babel/plugin-proposal-nullish-coalescing-operator
- @vue/babel-preset-jsx
### 依赖
由于使用了 `@babel/plugin-transform-runtime` 来优化 Babel 的 helper 函数,你需要将 `@babel/runtime` 添加到 `package.json` 的依赖项:
```json
{
"dependencies": {
"@babel/runtime": "7.x"
}
}
```
## Postcss
通过根目录下的`postcss.config.js`文件可以对 Postcss 进行配置。

View File

@ -38,12 +38,10 @@
},
"dependencies": {
"@babel/core": "^7.12.10",
"@babel/plugin-transform-runtime": "^7.12.10",
"@babel/preset-env": "^7.12.11",
"@babel/preset-typescript": "^7.12.7",
"@docsearch/css": "3.0.0-alpha.33",
"@docsearch/js": "3.0.0-alpha.33",
"@nuxt/friendly-errors-webpack-plugin": "^2.5.0",
"@types/webpack-dev-server": "^3.11.1",
"@vant/eslint-config": "^3.2.0",
"@vant/markdown-loader": "^4.1.0",
@ -82,7 +80,7 @@
"postcss": "^7.0.0",
"postcss-load-config": "^3.0.0",
"postcss-loader": "^4.1.0",
"prettier": "^2.2.1",
"prettier": "2.1.0",
"release-it": "^14.2.2",
"sass": "^1.32.4",
"sass-loader": "^10.1.1",

View File

@ -39,12 +39,12 @@ export const CONFIG_DIR = join(__dirname, '../config');
// Dist files
export const PACKAGE_ENTRY_FILE = join(DIST_DIR, 'package-entry.js');
export const PACKAGE_STYLE_FILE = join(DIST_DIR, 'package-style.css');
export const SITE_MODILE_SHARED_FILE = join(DIST_DIR, 'site-mobile-shared.js');
export const SITE_MOBILE_SHARED_FILE = join(DIST_DIR, 'site-mobile-shared.js');
export const SITE_DESKTOP_SHARED_FILE = join(
DIST_DIR,
'site-desktop-shared.js'
);
export const STYPE_DEPS_JSON_FILE = join(DIST_DIR, 'style-deps.json');
export const STYLE_DEPS_JSON_FILE = join(DIST_DIR, 'style-deps.json');
// Config files
export const BABEL_CONFIG_FILE = join(CONFIG_DIR, 'babel.config.js');

View File

@ -11,11 +11,11 @@ import {
ES_DIR,
SRC_DIR,
LIB_DIR,
STYPE_DEPS_JSON_FILE,
STYLE_DEPS_JSON_FILE,
} from '../common/constant';
function getDeps(component: string): string[] {
const styleDepsJson = require(STYPE_DEPS_JSON_FILE);
const styleDepsJson = require(STYLE_DEPS_JSON_FILE);
if (styleDepsJson.map[component]) {
const deps = styleDepsJson.map[component].slice(0);
@ -57,7 +57,7 @@ function genEntry(params: {
}) {
const { ext, filename, component, baseFile } = params;
const deps = getDeps(component);
const depsPath = deps.map(dep => getRelativePath(component, dep, ext));
const depsPath = deps.map((dep) => getRelativePath(component, dep, ext));
OUTPUT_CONFIG.forEach(({ dir, template }) => {
const outputDir = join(dir, component, 'style');
@ -81,13 +81,13 @@ export function genComponentStyle(
options: { cache: boolean } = { cache: true }
) {
if (!options.cache) {
delete require.cache[STYPE_DEPS_JSON_FILE];
delete require.cache[STYLE_DEPS_JSON_FILE];
}
const components = getComponents();
const baseFile = getCssBaseFile();
components.forEach(component => {
components.forEach((component) => {
genEntry({
baseFile,
component,

View File

@ -2,7 +2,7 @@ import { join } from 'path';
import { existsSync } from 'fs-extra';
import { smartOutputFile, normalizePath } from '../common';
import { CSS_LANG, getCssBaseFile } from '../common/css';
import { SRC_DIR, STYPE_DEPS_JSON_FILE } from '../common/constant';
import { SRC_DIR, STYLE_DEPS_JSON_FILE } from '../common/constant';
type Options = {
outputPath: string;
@ -10,7 +10,7 @@ type Options = {
};
export function genPackageStyle(options: Options) {
const styleDepsJson = require(STYPE_DEPS_JSON_FILE);
const styleDepsJson = require(STYLE_DEPS_JSON_FILE);
const ext = '.' + CSS_LANG;
let content = '';

View File

@ -3,7 +3,7 @@ import { CSS_LANG } from '../common/css';
import { existsSync } from 'fs-extra';
import { getDeps, clearDepsCache, fillExt } from './get-deps';
import { getComponents, smartOutputFile } from '../common';
import { SRC_DIR, STYPE_DEPS_JSON_FILE } from '../common/constant';
import { SRC_DIR, STYLE_DEPS_JSON_FILE } from '../common/constant';
function matchPath(path: string, component: string): boolean {
const p = relative(SRC_DIR, path);
@ -28,15 +28,15 @@ function analyzeComponentDeps(components: string[], component: string) {
function search(filePath: string) {
record.add(filePath);
getDeps(filePath).forEach(key => {
getDeps(filePath).forEach((key) => {
if (record.has(key)) {
return;
}
search(key);
components
.filter(item => matchPath(key, item))
.forEach(item => {
.filter((item) => matchPath(key, item))
.forEach((item) => {
if (!checkList.includes(item) && item !== component) {
checkList.push(item);
}
@ -80,7 +80,7 @@ function getSequence(components: string[], depsMap: DepsMap) {
return;
}
const maxIndex = Math.max(...deps.map(dep => sequence.indexOf(dep)));
const maxIndex = Math.max(...deps.map((dep) => sequence.indexOf(dep)));
sequence.splice(maxIndex + 1, 0, item);
}
@ -93,25 +93,25 @@ function getSequence(components: string[], depsMap: DepsMap) {
export async function genStyleDepsMap() {
const components = getComponents();
return new Promise<void>(resolve => {
return new Promise<void>((resolve) => {
clearDepsCache();
const map = {} as DepsMap;
components.forEach(component => {
components.forEach((component) => {
map[component] = analyzeComponentDeps(components, component);
});
const sequence = getSequence(components, map);
Object.keys(map).forEach(key => {
Object.keys(map).forEach((key) => {
map[key] = map[key].sort(
(a, b) => sequence.indexOf(a) - sequence.indexOf(b)
);
});
smartOutputFile(
STYPE_DEPS_JSON_FILE,
STYLE_DEPS_JSON_FILE,
JSON.stringify({ map, sequence }, null, 2)
);

View File

@ -27,13 +27,6 @@ module.exports = function (api?: ConfigAPI, options: PresetOption = {}) {
require('../compiler/babel-preset-vue-ts'),
],
plugins: [
[
require.resolve('@babel/plugin-transform-runtime'),
{
corejs: false,
useESModules,
},
],
[
require.resolve('babel-plugin-import'),
{

View File

@ -1,6 +1,5 @@
import sass from 'sass';
import webpack from 'webpack';
import FriendlyErrorsPlugin from '@nuxt/friendly-errors-webpack-plugin';
import { VueLoaderPlugin } from 'vue-loader';
import { join } from 'path';
import { consola } from '../common/logger';
@ -39,10 +38,6 @@ const plugins = [
__VUE_PROD_DEVTOOLS__: 'false',
}),
new VueLoaderPlugin(),
new FriendlyErrorsPlugin({
clearConsole: false,
logLevel: 'WARNING',
}),
];
const tsconfigPath = join(CWD, 'tsconfig.json');

View File

@ -9,7 +9,7 @@ import { getVantConfig, getWebpackConfig } from '../common';
import { VantCliSitePlugin } from '../compiler/vant-cli-site-plugin';
import {
GREEN,
SITE_MODILE_SHARED_FILE,
SITE_MOBILE_SHARED_FILE,
SITE_DESKTOP_SHARED_FILE,
} from '../common/constant';
@ -48,7 +48,6 @@ export function getSiteDevBaseConfig(): WebpackConfig {
},
devServer: {
port: 8080,
quiet: true,
host: '0.0.0.0',
stats: 'errors-only',
publicPath: '/',
@ -56,7 +55,7 @@ export function getSiteDevBaseConfig(): WebpackConfig {
},
resolve: {
alias: {
'site-mobile-shared': SITE_MODILE_SHARED_FILE,
'site-mobile-shared': SITE_MOBILE_SHARED_FILE,
'site-desktop-shared': SITE_DESKTOP_SHARED_FILE,
},
},

View File

@ -10,4 +10,3 @@ declare module 'html-webpack-plugin';
declare module 'conventional-changelog';
declare module '@vant/markdown-vetur';
declare module '@babel/helper-plugin-utils';
declare module '@nuxt/friendly-errors-webpack-plugin';

View File

@ -791,15 +791,6 @@
dependencies:
"@babel/helper-plugin-utils" "^7.10.4"
"@babel/plugin-transform-runtime@^7.12.10":
version "7.12.10"
resolved "https://registry.npm.taobao.org/@babel/plugin-transform-runtime/download/@babel/plugin-transform-runtime-7.12.10.tgz?cache=0&sync_timestamp=1607569369088&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fplugin-transform-runtime%2Fdownload%2F%40babel%2Fplugin-transform-runtime-7.12.10.tgz#af0fded4e846c4b37078e8e5d06deac6cd848562"
integrity sha1-rw/e1OhGxLNweOjl0G3qxs2EhWI=
dependencies:
"@babel/helper-module-imports" "^7.12.5"
"@babel/helper-plugin-utils" "^7.10.4"
semver "^5.5.1"
"@babel/plugin-transform-shorthand-properties@^7.12.1":
version "7.12.1"
resolved "https://registry.npm.taobao.org/@babel/plugin-transform-shorthand-properties/download/@babel/plugin-transform-shorthand-properties-7.12.1.tgz?cache=0&sync_timestamp=1602801648312&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fplugin-transform-shorthand-properties%2Fdownload%2F%40babel%2Fplugin-transform-shorthand-properties-7.12.1.tgz#0bf9cac5550fce0cfdf043420f661d645fdc75e3"
@ -1256,16 +1247,6 @@
"@nodelib/fs.scandir" "2.1.3"
fastq "^1.6.0"
"@nuxt/friendly-errors-webpack-plugin@^2.5.0":
version "2.5.0"
resolved "https://registry.yarnpkg.com/@nuxt/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-2.5.0.tgz#5374665bc72d34b7dbadcc361a4777e3f0f5d46b"
integrity sha512-pUgPFmRL56/xuTCGN5rqgTfxvs1N/AYJw7q7tUHiZaBm3UyPgbIVPkadS9njwbFbPD2XcebVy7npQMMVwQJWfA==
dependencies:
chalk "^2.3.2"
consola "^2.6.0"
error-stack-parser "^2.0.0"
string-width "^2.0.0"
"@octokit/auth-token@^2.4.0":
version "2.4.0"
resolved "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-2.4.0.tgz#b64178975218b99e4dfe948253f0673cbbb59d9f"
@ -2200,11 +2181,6 @@ ansi-regex@^2.0.0:
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8=
ansi-regex@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998"
integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=
ansi-regex@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997"
@ -2857,7 +2833,7 @@ chalk@4.1.0, chalk@^4.0.0, chalk@^4.1.0:
ansi-styles "^4.1.0"
supports-color "^7.1.0"
chalk@^2.0.0, chalk@^2.1.0, chalk@^2.3.2, chalk@^2.4.2:
chalk@^2.0.0, chalk@^2.1.0, chalk@^2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
@ -3201,7 +3177,7 @@ connect-history-api-fallback@^1.6.0:
resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc"
integrity sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==
consola@^2.15.0, consola@^2.6.0:
consola@^2.15.0:
version "2.15.0"
resolved "https://registry.npm.taobao.org/consola/download/consola-2.15.0.tgz?cache=0&sync_timestamp=1596625649554&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fconsola%2Fdownload%2Fconsola-2.15.0.tgz#40fc4eefa4d2f8ef2e2806147f056ea207fcc0e9"
integrity sha1-QPxO76TS+O8uKAYUfwVuogf8wOk=
@ -3982,13 +3958,6 @@ error-ex@^1.2.0, error-ex@^1.3.1:
dependencies:
is-arrayish "^0.2.1"
error-stack-parser@^2.0.0:
version "2.0.6"
resolved "https://registry.yarnpkg.com/error-stack-parser/-/error-stack-parser-2.0.6.tgz#5a99a707bd7a4c58a797902d48d82803ede6aad8"
integrity sha512-d51brTeqC+BHlwF0BhPtcYgF5nlzf9ZZ0ZIUQNZpc9ZB9qw5IJ2diTrBY9jlCJkTLITYPjmiX6OWCwH+fuyNgQ==
dependencies:
stackframe "^1.1.1"
es-abstract@^1.17.0, es-abstract@^1.17.0-next.1, es-abstract@^1.17.5:
version "1.17.6"
resolved "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz#9142071707857b2cacc7b89ecb670316c3e2d52a"
@ -8150,10 +8119,10 @@ prepend-http@^2.0.0:
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897"
integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=
prettier@^2.2.1:
version "2.2.1"
resolved "https://registry.npm.taobao.org/prettier/download/prettier-2.2.1.tgz?cache=0&sync_timestamp=1606523097359&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fprettier%2Fdownload%2Fprettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5"
integrity sha1-eVoaeN1S8HPaDNQrIfnJE4GSP/U=
prettier@2.1.0:
version "2.1.0"
resolved "http://registry.npm.qima-inc.com/prettier/download/prettier-2.1.0.tgz#5a9789f767a243118c60f3e56d95cb6544914fbb"
integrity sha1-WpeJ92eiQxGMYPPlbZXLZUSRT7s=
pretty-error@^2.1.1:
version "2.1.1"
@ -8989,7 +8958,7 @@ semver-diff@^3.1.1:
dependencies:
semver "^6.3.0"
"semver@2 || 3 || 4 || 5", semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0:
"semver@2 || 3 || 4 || 5", semver@^5.4.1, semver@^5.5.0, semver@^5.6.0:
version "5.7.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
@ -9372,11 +9341,6 @@ stack-utils@^2.0.2:
dependencies:
escape-string-regexp "^2.0.0"
stackframe@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.1.1.tgz#ffef0a3318b1b60c3b58564989aca5660729ec71"
integrity sha512-0PlYhdKh6AfFxRyK/v+6/k+/mMfyiEBbTM5L94D0ZytQnJ166wuwoTYLHFWGbs2dpA8Rgq763KGWmN1EQEYHRQ==
state-toggle@^1.0.0:
version "1.0.3"
resolved "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.3.tgz#e123b16a88e143139b09c6852221bc9815917dfe"
@ -9425,14 +9389,6 @@ string-length@^4.0.1:
char-regex "^1.0.2"
strip-ansi "^6.0.0"
string-width@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e"
integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==
dependencies:
is-fullwidth-code-point "^2.0.0"
strip-ansi "^4.0.0"
string-width@^3.0.0, string-width@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961"
@ -9497,13 +9453,6 @@ strip-ansi@^3.0.0, strip-ansi@^3.0.1:
dependencies:
ansi-regex "^2.0.0"
strip-ansi@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f"
integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8=
dependencies:
ansi-regex "^3.0.0"
strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae"

View File

@ -23,7 +23,6 @@
"devDependencies": {
"@babel/cli": "^7.12.8",
"@babel/core": "^7.12.9",
"@babel/runtime": "7.x",
"release-it": "^14.2.2",
"vue": "^3.0.0"
},

View File

@ -19,14 +19,13 @@ class LazyContainer {
update({ el, binding }) {
this.el = el;
this.options = { ...defaultOptions, ...binding.value };
this.options = Object.assign({}, defaultOptions, binding.value);
const imgs = this.getImgs();
imgs.forEach((el) => {
this.lazy.add(
el,
{
...this.binding,
Object.assign({}, this.binding, {
value: {
src: 'dataset' in el ? el.dataset.src : el.getAttribute('data-src'),
error:
@ -38,7 +37,7 @@ class LazyContainer {
? el.dataset.loading
: el.getAttribute('data-loading')) || this.options.loading,
},
},
}),
this.vnode
);
});

View File

@ -91,10 +91,7 @@ export default function () {
* @return
*/
config(options = {}) {
this.options = {
...this.options,
options,
};
Object.assign(this.options, options);
}
/**

View File

@ -161,13 +161,6 @@
resolved "https://registry.npm.taobao.org/@babel/parser/download/@babel/parser-7.12.7.tgz?cache=0&sync_timestamp=1605906390839&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fparser%2Fdownload%2F%40babel%2Fparser-7.12.7.tgz#fee7b39fe809d0e73e5b25eecaf5780ef3d73056"
integrity sha1-/uezn+gJ0Oc+WyXuyvV4DvPXMFY=
"@babel/runtime@7.x":
version "7.12.5"
resolved "https://registry.npm.taobao.org/@babel/runtime/download/@babel/runtime-7.12.5.tgz?cache=0&sync_timestamp=1604441208794&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fruntime%2Fdownload%2F%40babel%2Fruntime-7.12.5.tgz#410e7e487441e1b360c29be715d870d9b985882e"
integrity sha1-QQ5+SHRB4bNgwpvnFdhw2bmFiC4=
dependencies:
regenerator-runtime "^0.13.4"
"@babel/template@^7.10.4", "@babel/template@^7.12.7":
version "7.12.7"
resolved "https://registry.npm.taobao.org/@babel/template/download/@babel/template-7.12.7.tgz?cache=0&sync_timestamp=1605906405753&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Ftemplate%2Fdownload%2F%40babel%2Ftemplate-7.12.7.tgz#c817233696018e39fbb6c491d2fb684e05ed43bc"
@ -2284,11 +2277,6 @@ rechoir@^0.6.2:
dependencies:
resolve "^1.1.6"
regenerator-runtime@^0.13.4:
version "0.13.7"
resolved "https://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.13.7.tgz#cac2dacc8a1ea675feaabaeb8ae833898ae46f55"
integrity sha1-ysLazIoepnX+qrrriugziYrkb1U=
regex-not@^1.0.0, regex-not@^1.0.2:
version "1.0.2"
resolved "https://registry.npm.taobao.org/regex-not/download/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c"

View File

@ -23,7 +23,6 @@
"@popperjs/core": "^2.9.2"
},
"devDependencies": {
"@babel/runtime": "7.x",
"@rollup/plugin-babel": "^5.2.1",
"@rollup/plugin-node-resolve": "^10.0.0",
"release-it": "^14.2.2",

View File

@ -30,13 +30,6 @@
chalk "^2.0.0"
js-tokens "^4.0.0"
"@babel/runtime@7.x":
version "7.12.5"
resolved "https://registry.npm.taobao.org/@babel/runtime/download/@babel/runtime-7.12.5.tgz?cache=0&sync_timestamp=1604443606981&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fruntime%2Fdownload%2F%40babel%2Fruntime-7.12.5.tgz#410e7e487441e1b360c29be715d870d9b985882e"
integrity sha1-QQ5+SHRB4bNgwpvnFdhw2bmFiC4=
dependencies:
regenerator-runtime "^0.13.4"
"@babel/types@^7.12.5":
version "7.12.7"
resolved "https://registry.npm.taobao.org/@babel/types/download/@babel/types-7.12.7.tgz?cache=0&sync_timestamp=1605904888635&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Ftypes%2Fdownload%2F%40babel%2Ftypes-7.12.7.tgz#6039ff1e242640a29452c9ae572162ec9a8f5d13"
@ -1504,11 +1497,6 @@ rechoir@^0.6.2:
dependencies:
resolve "^1.1.6"
regenerator-runtime@^0.13.4:
version "0.13.7"
resolved "https://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.13.7.tgz#cac2dacc8a1ea675feaabaeb8ae833898ae46f55"
integrity sha1-ysLazIoepnX+qrrriugziYrkb1U=
registry-auth-token@^4.0.0:
version "4.2.1"
resolved "https://registry.npm.taobao.org/registry-auth-token/download/registry-auth-token-4.2.1.tgz#6d7b4006441918972ccd5fedcd41dc322c79b250"

View File

@ -24,9 +24,6 @@
},
"license": "MIT",
"repository": "https://github.com/youzan/vant/tree/dev/packages/vant-use",
"dependencies": {
"@babel/runtime": "7.x"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"gh-pages": "^3.1.0",

View File

@ -78,13 +78,18 @@ export function useChildren<
internalChildren.splice(index, 1);
};
provide(key, {
link,
unlink,
children: publicChildren,
internalChildren,
...value,
});
provide(
key,
Object.assign(
{
link,
unlink,
children: publicChildren,
internalChildren,
},
value
)
);
};
return {

View File

@ -20,7 +20,7 @@ export function useParent<T>(key: string | symbol) {
if (parent) {
const instance = getCurrentInstance()!;
const { link, unlink, internalChildren, ...rest } = parent;
const { link, unlink, internalChildren } = parent;
link(instance);
onUnmounted(() => unlink(instance));
@ -28,7 +28,7 @@ export function useParent<T>(key: string | symbol) {
const index = computed(() => internalChildren.indexOf(instance));
return {
parent: rest,
parent,
index,
};
}

View File

@ -911,13 +911,6 @@
"@babel/types" "^7.4.4"
esutils "^2.0.2"
"@babel/runtime@7.x":
version "7.12.5"
resolved "https://registry.npm.taobao.org/@babel/runtime/download/@babel/runtime-7.12.5.tgz?cache=0&sync_timestamp=1604441208794&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fruntime%2Fdownload%2F%40babel%2Fruntime-7.12.5.tgz#410e7e487441e1b360c29be715d870d9b985882e"
integrity sha1-QQ5+SHRB4bNgwpvnFdhw2bmFiC4=
dependencies:
regenerator-runtime "^0.13.4"
"@babel/runtime@^7.11.0", "@babel/runtime@^7.8.4":
version "7.11.2"
resolved "https://registry.npm.taobao.org/@babel/runtime/download/@babel/runtime-7.11.2.tgz?cache=0&sync_timestamp=1596637803941&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fruntime%2Fdownload%2F%40babel%2Fruntime-7.11.2.tgz#f549c13c754cc40b87644b9fa9f09a6a95fe0736"

View File

@ -1,5 +1,7 @@
# Waterfall 瀑布流
Tips: Waterfall 组件已废弃,请使用 List 组件代替。
### Install
#### NPM
@ -35,14 +37,15 @@ import Waterfall from '@vant/waterfall';
export default {
directives: {
WaterfallLower: Waterfall('lower'),
WaterfallUpper: Waterfall('upper')
}
WaterfallUpper: Waterfall('upper'),
},
};
```
### 代码演示
#### 基础用法
使用 `v-waterfall-lower` 监听滚动到达底部,并执行相应函数。若是函数执行中需要异步加载数据,可以将 `waterfall-disabled` 指定的值置为 true禁止 `v-waterfall-lower` 监听滚动事件
注意:`waterfall-disabled` 传入的是 vue 对象中表示是否禁止瀑布流触发 key 值,类型是字符串
@ -62,12 +65,12 @@ export default {
data() {
return {
list: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
disabled: false
disabled: false,
};
},
directives: {
WaterfallLower: Waterfall('lower')
WaterfallLower: Waterfall('lower'),
},
methods: {
@ -79,16 +82,16 @@ export default {
}
this.disabled = false;
}, 200);
}
}
},
},
};
```
### API
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|------|------|------|------|------|
| v-waterfall-lower | 滚动到底部, 触发执行的函数 | *Function* | - | - |
| v-waterfall-upper | 滚动到顶部, 触发执行的函数 | *Function* | - | - |
| waterfall-disabled | 在 vue 对象中表示是否禁止瀑布流触发的 key 值 | *string* | - | - |
| waterfall-offset | 触发瀑布流加载的阈值 | *number* | `300` | - |
| --- | --- | --- | --- | --- |
| v-waterfall-lower | 滚动到底部, 触发执行的函数 | _Function_ | - | - |
| v-waterfall-upper | 滚动到顶部, 触发执行的函数 | _Function_ | - | - |
| waterfall-disabled | 在 vue 对象中表示是否禁止瀑布流触发的 key 值 | _string_ | - | - |
| waterfall-offset | 触发瀑布流加载的阈值 | _number_ | `300` | - |

View File

@ -1,5 +1,5 @@
import { defineComponent } from 'vue';
import { extend, createNamespace, UnknownProp } from '../utils';
import { extend, createNamespace, unknownProp } from '../utils';
import { ACTION_BAR_KEY } from '../action-bar/ActionBar';
// Composables
@ -21,7 +21,7 @@ export default defineComponent({
icon: String,
color: String,
badge: [Number, String],
iconClass: UnknownProp,
iconClass: unknownProp,
}),
setup(props, { slots }) {

View File

@ -1,5 +1,5 @@
import { defineComponent } from 'vue';
import { createNamespace } from '../utils';
import { truthProp, createNamespace } from '../utils';
import { useChildren } from '@vant/use';
const [name, bem] = createNamespace('action-bar');
@ -10,10 +10,7 @@ export default defineComponent({
name,
props: {
safeAreaInsetBottom: {
type: Boolean,
default: true,
},
safeAreaInsetBottom: truthProp,
},
setup(props, { slots }) {

View File

@ -1,7 +1,7 @@
import { nextTick, PropType, defineComponent } from 'vue';
// Utils
import { pick, extend, createNamespace } from '../utils';
import { pick, extend, truthProp, createNamespace } from '../utils';
// Components
import { Icon } from '../icon';
@ -26,27 +26,18 @@ export default defineComponent({
props: extend({}, popupSharedProps, {
title: String,
round: truthProp,
actions: Array as PropType<ActionSheetAction[]>,
closeable: truthProp,
cancelText: String,
description: String,
closeOnPopstate: Boolean,
closeOnClickAction: Boolean,
round: {
type: Boolean,
default: true,
},
closeable: {
type: Boolean,
default: true,
},
safeAreaInsetBottom: truthProp,
closeIcon: {
type: String,
default: 'cross',
},
safeAreaInsetBottom: {
type: Boolean,
default: true,
},
}),
emits: ['select', 'cancel', 'update:show'],

View File

@ -13,6 +13,7 @@ import {
extend,
isObject,
isMobile,
truthProp,
createNamespace,
ComponentInstance,
} from '../utils';
@ -73,6 +74,8 @@ export default defineComponent({
validator: Function as PropType<
(key: string, value: string) => string | undefined
>,
showArea: truthProp,
showDetail: truthProp,
showDelete: Boolean,
showPostal: Boolean,
disableArea: Boolean,
@ -83,14 +86,6 @@ export default defineComponent({
areaPlaceholder: String,
deleteButtonText: String,
showSearchResult: Boolean,
showArea: {
type: Boolean,
default: true,
},
showDetail: {
type: Boolean,
default: true,
},
detailRows: {
type: [Number, String],
default: 1,

View File

@ -1,7 +1,7 @@
import { PropType, defineComponent } from 'vue';
// Utils
import { createNamespace } from '../utils';
import { truthProp, createNamespace } from '../utils';
// Components
import { Button } from '../button';
@ -15,6 +15,7 @@ export default defineComponent({
props: {
modelValue: [Number, String],
switchable: truthProp,
disabledText: String,
addButtonText: String,
defaultTagText: String,
@ -26,10 +27,6 @@ export default defineComponent({
type: Array as PropType<AddressListAddress[]>,
default: () => [],
},
switchable: {
type: Boolean,
default: true,
},
},
emits: [

View File

@ -1,5 +1,11 @@
import { PropType, CSSProperties, defineComponent } from 'vue';
import { isDef, isNumeric, createNamespace } from '../utils';
import {
isDef,
addUnit,
isNumeric,
truthProp,
createNamespace,
} from '../utils';
const [name, bem] = createNamespace('badge');
@ -10,16 +16,13 @@ export default defineComponent({
dot: Boolean,
max: [Number, String],
color: String,
offset: (Array as unknown) as PropType<[number, number]>,
offset: (Array as unknown) as PropType<[string | number, string | number]>,
content: [Number, String],
showZero: truthProp,
tag: {
type: String as PropType<keyof HTMLElementTagNameMap>,
default: 'div',
},
showZero: {
type: Boolean,
default: true,
},
},
setup(props, { slots }) {
@ -56,11 +59,11 @@ export default defineComponent({
if (props.offset) {
const [x, y] = props.offset;
if (slots.default) {
style.top = `${y}px`;
style.right = `${-x}px`;
style.top = addUnit(y);
style.right = `-${addUnit(x)}`;
} else {
style.marginTop = `${y}px`;
style.marginLeft = `${x}px`;
style.marginTop = addUnit(y);
style.marginLeft = addUnit(x);
}
}

View File

@ -123,7 +123,7 @@ Use `content` slot to custom :content of badge.
| color | Background color | _string_ | `#ee0a24` |
| dot | Whether to show dot | _boolean_ | `false` |
| max | Max valueshow `{max}+` when exceedonly works when content is number | _number \| string_ | - |
| offset `v3.0.5` | Offset of badge dot | _[number, number]_ | - |
| offset `v3.0.5` | Offset of badge dot | _[number \| string, number \| string]_ | - |
| show-zero `v3.0.10` | Whether to show badge when content is zero | _boolean_ | `true` |
### Slots

View File

@ -131,7 +131,7 @@ app.use(Badge);
| color | 徽标背景颜色 | _string_ | `#ee0a24` |
| dot | 是否展示为小红点 | _boolean_ | `false` |
| max | 最大值,超过最大值会显示 `{max}+`,仅当 content 为数字时有效 | _number \| string_ | - |
| offset `v3.0.5` | 设置徽标的偏移量,数组的两项分别对应水平和垂直方向的偏移量 | _[number, number]_ | - |
| offset `v3.0.5` | 设置徽标的偏移量,数组的两项分别对应水平和垂直方向的偏移量,默认单位为 `px` | _[number \| string, number \| string]_ | - |
| show-zero `v3.0.10` | 当 content 为数字 0 时,是否展示徽标 | _boolean_ | `true` |
### Slots

View File

@ -57,6 +57,22 @@ test('should change dot position when using offset prop', () => {
expect(badge.style.right).toEqual('-2px');
});
test('should change dot position when using offset prop with custom unit', () => {
const wrapper = mount(Badge, {
props: {
dot: true,
offset: ['2rem', '4em'],
},
slots: {
default: () => 'Child',
},
});
const badge = wrapper.find('.van-badge');
expect(badge.style.top).toEqual('4em');
expect(badge.style.right).toEqual('-2rem');
});
test('should change dot position when using offset prop without children', () => {
const wrapper = mount(Badge, {
props: {

View File

@ -77,9 +77,9 @@ export default defineComponent({
return (
<Loading
class={bem('loading')}
size={props.loadingSize}
type={props.loadingType}
class={bem('loading')}
/>
);
};
@ -116,9 +116,9 @@ export default defineComponent({
const getStyle = () => {
const { color, plain } = props;
if (color) {
const style: CSSProperties = {};
style.color = plain ? color : 'white';
const style: CSSProperties = {
color: plain ? color : 'white',
};
if (!plain) {
// Use background instead of backgroundColor to make linear-gradient work
@ -139,8 +139,7 @@ export default defineComponent({
const onClick = (event: MouseEvent) => {
if (props.loading) {
event.preventDefault();
}
if (!props.loading && !props.disabled) {
} else if (!props.disabled) {
emit('click', event);
route();
}

View File

@ -9,13 +9,19 @@ import {
} from 'vue';
// Utils
import { pick, isDate, getScrollTop, ComponentInstance } from '../utils';
import {
pick,
isDate,
truthProp,
getScrollTop,
ComponentInstance,
} from '../utils';
import {
t,
bem,
name,
copyDate,
copyDates,
cloneDate,
cloneDates,
getPrevDay,
getNextDay,
compareDay,
@ -46,69 +52,39 @@ export default defineComponent({
show: Boolean,
title: String,
color: String,
round: truthProp,
readonly: Boolean,
poppable: truthProp,
teleport: [String, Object] as PropType<TeleportProps['to']>,
showMark: truthProp,
showTitle: truthProp,
formatter: Function as PropType<(item: CalendarDayItem) => CalendarDayItem>,
rowHeight: [Number, String],
confirmText: String,
rangePrompt: String,
lazyRender: truthProp,
showConfirm: truthProp,
// TODO: remove any
// see: https://github.com/vuejs/vue-next/issues/2668
defaultDate: [Date, Array] as any,
allowSameDay: Boolean,
showSubtitle: truthProp,
closeOnPopstate: truthProp,
confirmDisabledText: String,
closeOnClickOverlay: truthProp,
safeAreaInsetBottom: truthProp,
type: {
type: String as PropType<CalendarType>,
default: 'single',
},
round: {
type: Boolean,
default: true,
},
position: {
type: String as PropType<PopupPosition>,
default: 'bottom',
},
poppable: {
type: Boolean,
default: true,
},
maxRange: {
type: [Number, String],
default: null,
},
lazyRender: {
type: Boolean,
default: true,
},
showMark: {
type: Boolean,
default: true,
},
showTitle: {
type: Boolean,
default: true,
},
showConfirm: {
type: Boolean,
default: true,
},
showSubtitle: {
type: Boolean,
default: true,
},
closeOnPopstate: {
type: Boolean,
default: true,
},
closeOnClickOverlay: {
type: Boolean,
default: true,
},
safeAreaInsetBottom: {
type: Boolean,
default: true,
},
minDate: {
type: Date,
validator: isDate,
@ -341,12 +317,12 @@ export default defineComponent({
return true;
};
const onConfirm = () => emit('confirm', copyDates(state.currentDate));
const onConfirm = () => emit('confirm', cloneDates(state.currentDate));
const select = (date: Date | Date[], complete?: boolean) => {
const setCurrentDate = (date: Date | Date[]) => {
state.currentDate = date;
emit('select', copyDates(state.currentDate));
emit('select', cloneDates(state.currentDate));
};
if (complete && props.type === 'range') {
@ -422,7 +398,7 @@ export default defineComponent({
if (selected) {
const [unselectedDate] = currentDate.splice(selectedIndex, 1);
emit('unselect', copyDate(unselectedDate));
emit('unselect', cloneDate(unselectedDate));
} else if (props.maxRange && currentDate.length >= props.maxRange) {
Toast(props.rangePrompt || t('rangePrompt', props.maxRange));
} else {

View File

@ -11,10 +11,10 @@ export function formatMonthTitle(date: Date) {
export function compareMonth(date1: Date, date2: Date) {
const year1 = date1.getFullYear();
const year2 = date2.getFullYear();
const month1 = date1.getMonth();
const month2 = date2.getMonth();
if (year1 === year2) {
const month1 = date1.getMonth();
const month2 = date2.getMonth();
return month1 === month2 ? 0 : month1 > month2 ? 1 : -1;
}
@ -27,48 +27,28 @@ export function compareDay(day1: Date, day2: Date) {
if (compareMonthResult === 0) {
const date1 = day1.getDate();
const date2 = day2.getDate();
return date1 === date2 ? 0 : date1 > date2 ? 1 : -1;
}
return compareMonthResult;
}
export const cloneDate = (date: Date) => new Date(date);
export const cloneDates = (dates: Date | Date[]) =>
Array.isArray(dates) ? dates.map(cloneDate) : cloneDate(dates);
export function getDayByOffset(date: Date, offset: number) {
date = new Date(date);
date.setDate(date.getDate() + offset);
return date;
const cloned = cloneDate(date);
cloned.setDate(cloned.getDate() + offset);
return cloned;
}
export function getPrevDay(date: Date) {
return getDayByOffset(date, -1);
}
export function getNextDay(date: Date) {
return getDayByOffset(date, 1);
}
export const getPrevDay = (date: Date) => getDayByOffset(date, -1);
export const getNextDay = (date: Date) => getDayByOffset(date, 1);
export function calcDateNum(date: [Date, Date]) {
const day1 = date[0].getTime();
const day2 = date[1].getTime();
return (day2 - day1) / (1000 * 60 * 60 * 24) + 1;
}
export function copyDate(dates: Date) {
return new Date(dates);
}
export function copyDates(dates: Date | Date[]) {
if (Array.isArray(dates)) {
return dates.map((date) => {
if (date === null) {
return date;
}
return copyDate(date);
});
}
return copyDate(dates);
}

View File

@ -1,5 +1,5 @@
import { nextTick, PropType, reactive, watch, defineComponent } from 'vue';
import { createNamespace, extend } from '../utils';
import { createNamespace, truthProp, extend } from '../utils';
// Components
import { Tab } from '../tab';
@ -32,6 +32,8 @@ export default defineComponent({
props: {
title: String,
closeable: truthProp,
swipeable: truthProp,
modelValue: [Number, String],
fieldNames: Object as PropType<CascaderFieldNames>,
placeholder: String,
@ -40,18 +42,10 @@ export default defineComponent({
type: Array as PropType<CascaderOption[]>,
default: () => [],
},
closeable: {
type: Boolean,
default: true,
},
closeIcon: {
type: String,
default: 'cross',
},
swipeable: {
type: Boolean,
default: true,
},
},
emits: ['close', 'change', 'finish', 'update:modelValue'],

View File

@ -1,5 +1,5 @@
import { defineComponent } from 'vue';
import { createNamespace } from '../utils';
import { truthProp, createNamespace } from '../utils';
import { BORDER_TOP_BOTTOM } from '../utils/constant';
const [name, bem] = createNamespace('cell-group');
@ -11,10 +11,7 @@ export default defineComponent({
props: {
title: String,
border: {
type: Boolean,
default: true,
},
border: truthProp,
},
setup(props, { slots, attrs }) {

View File

@ -1,7 +1,13 @@
import { PropType, CSSProperties, defineComponent } from 'vue';
// Utils
import { createNamespace, extend, isDef, UnknownProp } from '../utils';
import {
createNamespace,
extend,
isDef,
truthProp,
unknownProp,
} from '../utils';
// Composables
import { useRoute, routeProps } from '../composables/use-route';
@ -21,17 +27,14 @@ export const cellProps = {
label: [Number, String],
center: Boolean,
isLink: Boolean,
border: truthProp,
required: Boolean,
iconPrefix: String,
valueClass: UnknownProp,
labelClass: UnknownProp,
titleClass: UnknownProp,
valueClass: unknownProp,
labelClass: unknownProp,
titleClass: unknownProp,
titleStyle: (null as unknown) as PropType<string | CSSProperties>,
arrowDirection: String as PropType<CellArrowDirection>,
border: {
type: Boolean,
default: true,
},
clickable: {
type: Boolean as PropType<boolean | null>,
default: null,

View File

@ -1,7 +1,7 @@
import { computed, watch, defineComponent } from 'vue';
// Utils
import { createNamespace, extend, pick } from '../utils';
import { createNamespace, extend, pick, truthProp } from '../utils';
import {
CHECKBOX_GROUP_KEY,
CheckboxGroupProvide,
@ -21,10 +21,7 @@ export default defineComponent({
name,
props: extend({}, checkerProps, {
bindGroup: {
type: Boolean,
default: true,
},
bindGroup: truthProp,
}),
emits: ['change', 'update:modelValue'],

View File

@ -1,5 +1,5 @@
import { ref, computed, PropType, defineComponent } from 'vue';
import { addUnit, extend, UnknownProp } from '../utils';
import { addUnit, extend, unknownProp, truthProp } from '../utils';
import { Icon } from '../icon';
export type CheckerShape = 'square' | 'round';
@ -15,10 +15,10 @@ export type CheckerParent = {
};
export const checkerProps = {
name: UnknownProp,
name: unknownProp,
disabled: Boolean,
iconSize: [Number, String],
modelValue: UnknownProp,
modelValue: unknownProp,
checkedColor: String,
labelPosition: String as PropType<CheckerLabelPosition>,
labelDisabled: Boolean,
@ -33,10 +33,7 @@ export default defineComponent({
role: String,
parent: Object as PropType<CheckerParent | null>,
checked: Boolean,
bindGroup: {
type: Boolean,
default: true,
},
bindGroup: truthProp,
bem: {
type: Function,
required: true as const,

View File

@ -1,6 +1,6 @@
import { watch, computed, PropType, CSSProperties, defineComponent } from 'vue';
import { raf, cancelRaf } from '@vant/use';
import { isObject, getSizeStyle, createNamespace } from '../utils';
import { isObject, getSizeStyle, truthProp, createNamespace } from '../utils';
const [name, bem] = createNamespace('circle');
@ -24,6 +24,7 @@ export default defineComponent({
text: String,
size: [Number, String],
color: [String, Object] as PropType<string | Record<string, string>>,
clockwise: truthProp,
layerColor: String,
strokeLinecap: String as PropType<CanvasLineCap>,
currentRate: {
@ -46,10 +47,6 @@ export default defineComponent({
type: [Number, String],
default: 40,
},
clockwise: {
type: Boolean,
default: true,
},
},
emits: ['update:currentRate'],

View File

@ -2,7 +2,7 @@ import { ref, watch, computed, nextTick, defineComponent } from 'vue';
// Utils
import { cellProps } from '../cell/Cell';
import { createNamespace, extend, pick } from '../utils';
import { createNamespace, extend, pick, truthProp } from '../utils';
import { COLLAPSE_KEY, CollapseProvide } from '../collapse/Collapse';
// Composables
@ -20,12 +20,9 @@ export default defineComponent({
props: extend({}, cellProps, {
name: [Number, String],
isLink: truthProp,
disabled: Boolean,
readonly: Boolean,
isLink: {
type: Boolean,
default: true,
},
}),
setup(props, { slots }) {

View File

@ -1,5 +1,5 @@
import { PropType, defineComponent } from 'vue';
import { createNamespace } from '../utils';
import { truthProp, createNamespace } from '../utils';
import { BORDER_TOP_BOTTOM } from '../utils/constant';
import { useChildren } from '@vant/use';
@ -16,6 +16,7 @@ export default defineComponent({
name,
props: {
border: truthProp,
accordion: Boolean,
modelValue: {
type: [String, Number, Array] as PropType<
@ -23,10 +24,6 @@ export default defineComponent({
>,
default: '',
},
border: {
type: Boolean,
default: true,
},
},
emits: ['change', 'update:modelValue'],

View File

@ -30,7 +30,5 @@ export function route(vm: ComponentPublicInstance<RouteProps>) {
export function useRoute() {
const vm = getCurrentInstance()!.proxy as ComponentPublicInstance<RouteProps>;
return () => {
route(vm);
};
return () => route(vm);
}

View File

@ -1,5 +1,5 @@
import { PropType, defineComponent } from 'vue';
import { createNamespace } from '../utils';
import { truthProp, createNamespace } from '../utils';
import { Cell } from '../cell';
const [name, bem, t] = createNamespace('contact-card');
@ -13,10 +13,7 @@ export default defineComponent({
tel: String,
name: String,
addText: String,
editable: {
type: Boolean,
default: true,
},
editable: truthProp,
type: {
type: String as PropType<ContactCardType>,
default: 'add',

View File

@ -1,7 +1,7 @@
import { PropType, defineComponent } from 'vue';
// Utils
import { createNamespace, UnknownProp } from '../utils';
import { createNamespace, unknownProp } from '../utils';
// Components
import { Tag } from '../tag';
@ -26,7 +26,7 @@ export default defineComponent({
props: {
list: Array as PropType<ContactListItem[]>,
addText: String,
modelValue: UnknownProp,
modelValue: unknownProp,
defaultTagText: String,
},

View File

@ -1,7 +1,7 @@
import { watch, computed, defineComponent } from 'vue';
// Utils
import { createNamespace } from '../utils';
import { truthProp, createNamespace } from '../utils';
import { parseFormat } from './utils';
// Composables
@ -14,6 +14,7 @@ export default defineComponent({
name,
props: {
autoStart: truthProp,
millisecond: Boolean,
time: {
type: [Number, String],
@ -23,10 +24,6 @@ export default defineComponent({
type: String,
default: 'HH:mm:ss',
},
autoStart: {
type: Boolean,
default: true,
},
},
emits: ['change', 'finish'],

View File

@ -1,7 +1,7 @@
import { PropType, defineComponent } from 'vue';
// Utils
import { isDef, createNamespace } from '../utils';
import { isDef, truthProp, createNamespace } from '../utils';
// Components
import { Cell } from '../cell';
@ -38,6 +38,8 @@ export default defineComponent({
props: {
title: String,
border: truthProp,
editable: truthProp,
coupons: {
type: Array as PropType<CouponInfo[]>,
default: () => [],
@ -46,14 +48,6 @@ export default defineComponent({
type: String,
default: '¥',
},
border: {
type: Boolean,
default: true,
},
editable: {
type: Boolean,
default: true,
},
chosenCoupon: {
type: [Number, String],
default: -1,

View File

@ -9,7 +9,7 @@ import {
} from 'vue';
// Utils
import { createNamespace } from '../utils';
import { truthProp, createNamespace } from '../utils';
// Composables
import { useWindowSize } from '@vant/use';
@ -29,8 +29,11 @@ export default defineComponent({
name,
props: {
showCount: truthProp,
enabledTitle: String,
disabledTitle: String,
showExchangeBar: truthProp,
showCloseButton: truthProp,
closeButtonText: String,
inputPlaceholder: String,
exchangeButtonText: String,
@ -60,18 +63,6 @@ export default defineComponent({
type: Number,
default: -1,
},
showExchangeBar: {
type: Boolean,
default: true,
},
showCloseButton: {
type: Boolean,
default: true,
},
showCount: {
type: Boolean,
default: true,
},
currency: {
type: String,
default: '¥',

View File

@ -6,8 +6,9 @@ import {
pick,
extend,
addUnit,
truthProp,
isFunction,
UnknownProp,
unknownProp,
createNamespace,
} from '../utils';
import { BORDER_TOP, BORDER_LEFT } from '../utils/constant';
@ -42,27 +43,21 @@ export default defineComponent({
message: [String, Function] as PropType<DialogMessage>,
callback: Function as PropType<(action?: DialogAction) => void>,
allowHtml: Boolean,
className: UnknownProp,
className: unknownProp,
beforeClose: Function as PropType<Interceptor>,
messageAlign: String as PropType<DialogMessageAlign>,
closeOnPopstate: truthProp,
showCancelButton: Boolean,
cancelButtonText: String,
cancelButtonColor: String,
confirmButtonText: String,
confirmButtonColor: String,
showConfirmButton: truthProp,
closeOnClickOverlay: Boolean,
transition: {
type: String,
default: 'van-dialog-bounce',
},
showConfirmButton: {
type: Boolean,
default: true,
},
closeOnPopstate: {
type: Boolean,
default: true,
},
}),
emits: ['confirm', 'cancel', 'update:show'],

View File

@ -1,5 +1,5 @@
import { PropType, defineComponent } from 'vue';
import { createNamespace } from '../utils';
import { truthProp, createNamespace } from '../utils';
const [name, bem] = createNamespace('divider');
@ -10,10 +10,7 @@ export default defineComponent({
props: {
dashed: Boolean,
hairline: {
type: Boolean,
default: true,
},
hairline: truthProp,
contentPosition: {
type: String as PropType<DividerContentPosition>,
default: 'center',

View File

@ -8,7 +8,12 @@ import {
} from 'vue';
// Utils
import { createNamespace, getZIndexStyle, UnknownProp } from '../utils';
import {
truthProp,
unknownProp,
getZIndexStyle,
createNamespace,
} from '../utils';
import {
DROPDOWN_KEY,
DropdownMenuProvide,
@ -38,16 +43,13 @@ export default defineComponent({
title: String,
disabled: Boolean,
teleport: [String, Object] as PropType<TeleportProps['to']>,
modelValue: UnknownProp,
titleClass: UnknownProp,
lazyRender: truthProp,
modelValue: unknownProp,
titleClass: unknownProp,
options: {
type: Array as PropType<DropdownItemOption[]>,
default: () => [],
},
lazyRender: {
type: Boolean,
default: true,
},
},
emits: ['open', 'opened', 'close', 'closed', 'change', 'update:modelValue'],

View File

@ -9,7 +9,7 @@ import {
} from 'vue';
// Utils
import { isDef, ComponentInstance, createNamespace } from '../utils';
import { isDef, truthProp, createNamespace, ComponentInstance } from '../utils';
// Composables
import {
@ -27,12 +27,11 @@ export const DROPDOWN_KEY = Symbol(name);
export type DropdownMenuDirection = 'up' | 'down';
const props = {
overlay: truthProp,
zIndex: [Number, String],
activeColor: String,
overlay: {
type: Boolean,
default: true,
},
closeOnClickOutside: truthProp,
closeOnClickOverlay: truthProp,
duration: {
type: [Number, String],
default: 0.2,
@ -41,14 +40,6 @@ const props = {
type: String as PropType<DropdownMenuDirection>,
default: 'down',
},
closeOnClickOutside: {
type: Boolean,
default: true,
},
closeOnClickOverlay: {
type: Boolean,
default: true,
},
};
export type DropdownMenuProvide = {

View File

@ -15,7 +15,7 @@ import {
isDef,
extend,
addUnit,
UnknownProp,
unknownProp,
resetScroll,
formatNumber,
preventDefault,
@ -83,7 +83,7 @@ export const fieldProps = {
default: 'clear',
},
modelValue: {
type: [String, Number],
type: [Number, String],
default: '',
},
clearTrigger: {
@ -105,7 +105,7 @@ export default defineComponent({
rules: Array as PropType<FieldRule[]>,
autosize: [Boolean, Object] as PropType<boolean | FieldAutosizeConfig>,
labelWidth: [Number, String],
labelClass: UnknownProp,
labelClass: unknownProp,
labelAlign: String as PropType<FieldTextAlign>,
autocomplete: String,
showWordLimit: Boolean,

View File

@ -1,7 +1,7 @@
import { PropType, defineComponent } from 'vue';
// Utils
import { createNamespace, ComponentInstance } from '../utils';
import { truthProp, createNamespace, ComponentInstance } from '../utils';
// Composables
import { useChildren } from '@vant/use';
@ -30,19 +30,13 @@ export default defineComponent({
inputAlign: String as PropType<FieldTextAlign>,
scrollToError: Boolean,
validateFirst: Boolean,
submitOnEnter: truthProp,
showErrorMessage: truthProp,
errorMessageAlign: String as PropType<FieldTextAlign>,
submitOnEnter: {
type: Boolean,
default: true,
},
validateTrigger: {
type: String as PropType<FieldValidateTrigger>,
default: 'onBlur',
},
showErrorMessage: {
type: Boolean,
default: true,
},
},
emits: ['submit', 'failed'],

View File

@ -1,5 +1,5 @@
import { PropType, defineComponent, ExtractPropTypes } from 'vue';
import { createNamespace, addUnit } from '../utils';
import { createNamespace, addUnit, truthProp } from '../utils';
import { BORDER_TOP } from '../utils/constant';
import { useChildren } from '@vant/use';
@ -11,6 +11,8 @@ export type GridDirection = 'horizontal' | 'vertical';
const props = {
square: Boolean,
center: truthProp,
border: truthProp,
gutter: [Number, String],
iconSize: [Number, String],
direction: String as PropType<GridDirection>,
@ -19,14 +21,6 @@ const props = {
type: [Number, String],
default: 4,
},
center: {
type: Boolean,
default: true,
},
border: {
type: Boolean,
default: true,
},
};
export type GridProvide = {

View File

@ -12,7 +12,8 @@ import {
// Utils
import {
pick,
UnknownProp,
truthProp,
unknownProp,
createNamespace,
ComponentInstance,
} from '../utils';
@ -40,24 +41,20 @@ export default defineComponent({
props: {
show: Boolean,
loop: truthProp,
overlay: truthProp,
closeable: Boolean,
showIndex: truthProp,
className: unknownProp,
transition: String,
className: UnknownProp,
beforeClose: Function as PropType<Interceptor>,
overlayStyle: Object as PropType<CSSProperties>,
showIndicators: Boolean,
closeOnPopstate: truthProp,
images: {
type: Array as PropType<string[]>,
default: () => [],
},
loop: {
type: Boolean,
default: true,
},
overlay: {
type: Boolean,
default: true,
},
minZoom: {
type: [Number, String],
default: 1 / 3,
@ -66,10 +63,6 @@ export default defineComponent({
type: [Number, String],
default: 3,
},
showIndex: {
type: Boolean,
default: true,
},
swipeDuration: {
type: [Number, String],
default: 300,
@ -82,10 +75,6 @@ export default defineComponent({
type: String,
default: 'clear',
},
closeOnPopstate: {
type: Boolean,
default: true,
},
closeIconPosition: {
type: String as PropType<PopupCloseIconPosition>,
default: 'top-right',

View File

@ -14,6 +14,7 @@ import {
isDef,
addUnit,
inBrowser,
truthProp,
createNamespace,
ComponentInstance,
} from '../utils';
@ -38,15 +39,9 @@ export default defineComponent({
radius: [Number, String],
lazyLoad: Boolean,
iconSize: [Number, String],
showError: truthProp,
iconPrefix: String,
showError: {
type: Boolean,
default: true,
},
showLoading: {
type: Boolean,
default: true,
},
showLoading: truthProp,
errorIcon: {
type: String,
default: 'photo-fail',

View File

@ -14,6 +14,7 @@ import {
import {
isDef,
isHidden,
truthProp,
getScrollTop,
preventDefault,
createNamespace,
@ -46,12 +47,9 @@ const [name, bem] = createNamespace('index-bar');
export const INDEX_BAR_KEY = Symbol(name);
const props = {
sticky: truthProp,
zIndex: [Number, String],
highlightColor: String,
sticky: {
type: Boolean,
default: true,
},
stickyOffsetTop: {
type: Number,
default: 0,

View File

@ -9,7 +9,7 @@ import {
} from 'vue';
// Utils
import { isHidden, createNamespace } from '../utils';
import { isHidden, truthProp, createNamespace } from '../utils';
// Composables
import { useRect, useScrollParent, useEventListener } from '@vant/use';
@ -30,6 +30,7 @@ export default defineComponent({
errorText: String,
loadingText: String,
finishedText: String,
immediateCheck: truthProp,
offset: {
type: [Number, String],
default: 300,
@ -38,10 +39,6 @@ export default defineComponent({
type: String as PropType<'up' | 'down'>,
default: 'down',
},
immediateCheck: {
type: Boolean,
default: true,
},
},
emits: ['load', 'update:error', 'update:loading'],

View File

@ -1,7 +1,7 @@
import { ref, CSSProperties, defineComponent } from 'vue';
// Utils
import { createNamespace, getZIndexStyle } from '../utils';
import { truthProp, createNamespace, getZIndexStyle } from '../utils';
import { BORDER_BOTTOM } from '../utils/constant';
// Composables
@ -19,15 +19,12 @@ export default defineComponent({
title: String,
fixed: Boolean,
zIndex: [Number, String],
border: truthProp,
leftText: String,
rightText: String,
leftArrow: Boolean,
placeholder: Boolean,
safeAreaInsetTop: Boolean,
border: {
type: Boolean,
default: true,
},
},
emits: ['click-left', 'click-right'],

View File

@ -1,5 +1,5 @@
import { PropType, defineComponent } from 'vue';
import { createNamespace, extend, UnknownProp } from '../utils';
import { createNamespace, extend, unknownProp } from '../utils';
import { Popup } from '../popup';
import { popupSharedProps } from '../popup/shared';
@ -13,7 +13,7 @@ export default defineComponent({
props: extend({}, popupSharedProps, {
color: String,
message: [Number, String],
className: UnknownProp,
className: unknownProp,
background: String,
lockScroll: Boolean,
type: {

View File

@ -9,8 +9,19 @@ import {
TeleportProps,
defineComponent,
} from 'vue';
import { createNamespace, getZIndexStyle, stopPropagation } from '../utils';
// Utils
import {
truthProp,
getZIndexStyle,
stopPropagation,
createNamespace,
} from '../utils';
// Composables
import { useClickAway } from '@vant/use';
// Components
import NumberKeyboardKey, { KeyType } from './NumberKeyboardKey';
const [name, bem] = createNamespace('number-keyboard');
@ -32,10 +43,15 @@ export default defineComponent({
title: String,
zIndex: [Number, String],
teleport: [String, Object] as PropType<TeleportProps['to']>,
transition: truthProp,
blurOnClose: truthProp,
showDeleteKey: truthProp,
randomKeyOrder: Boolean,
closeButtonText: String,
deleteButtonText: String,
closeButtonLoading: Boolean,
hideOnClickOutside: truthProp,
safeAreaInsetBottom: truthProp,
theme: {
type: String as PropType<NumberKeyboardTheme>,
default: 'default',
@ -52,26 +68,6 @@ export default defineComponent({
type: [Number, String],
default: Number.MAX_VALUE,
},
transition: {
type: Boolean,
default: true,
},
blurOnClose: {
type: Boolean,
default: true,
},
showDeleteKey: {
type: Boolean,
default: true,
},
hideOnClickOutside: {
type: Boolean,
default: true,
},
safeAreaInsetBottom: {
type: Boolean,
default: true,
},
},
emits: [

View File

@ -3,7 +3,8 @@ import {
noop,
isDef,
extend,
UnknownProp,
truthProp,
unknownProp,
preventDefault,
createNamespace,
getZIndexStyle,
@ -19,12 +20,9 @@ export default defineComponent({
show: Boolean,
zIndex: [Number, String],
duration: [Number, String],
className: UnknownProp,
className: unknownProp,
lockScroll: truthProp,
customStyle: Object as PropType<CSSProperties>,
lockScroll: {
type: Boolean,
default: true,
},
},
setup(props, { slots }) {

View File

@ -1,5 +1,5 @@
import { defineComponent } from 'vue';
import { createNamespace, addUnit } from '../utils';
import { createNamespace, addUnit, truthProp } from '../utils';
import { BORDER_LEFT, BORDER_SURROUND } from '../utils/constant';
const [name, bem] = createNamespace('password-input');
@ -9,13 +9,10 @@ export default defineComponent({
props: {
info: String,
mask: truthProp,
gutter: [Number, String],
focused: Boolean,
errorInfo: String,
mask: {
type: Boolean,
default: true,
},
value: {
type: String,
default: '',

View File

@ -4,6 +4,7 @@ import { ref, watch, computed, PropType, defineComponent } from 'vue';
import {
extend,
unitToPx,
truthProp,
preventDefault,
createNamespace,
ComponentInstance,
@ -46,16 +47,13 @@ export const pickerProps = {
loading: Boolean,
readonly: Boolean,
allowHtml: Boolean,
showToolbar: truthProp,
cancelButtonText: String,
confirmButtonText: String,
itemHeight: {
type: [Number, String],
default: 44,
},
showToolbar: {
type: Boolean,
default: true,
},
visibleItemCount: {
type: [Number, String],
default: 6,

View File

@ -6,7 +6,7 @@ import { deepClone } from '../utils/deep-clone';
import {
range,
isObject,
UnknownProp,
unknownProp,
preventDefault,
createNamespace,
} from '../utils';
@ -66,7 +66,7 @@ export default defineComponent({
props: {
readonly: Boolean,
allowHtml: Boolean,
className: UnknownProp,
className: unknownProp,
textKey: {
type: String,
required: true,

View File

@ -15,7 +15,8 @@ import { Instance, createPopper, offsetModifier } from '@vant/popperjs';
import {
pick,
extend,
UnknownProp,
truthProp,
unknownProp,
createNamespace,
ComponentInstance,
} from '../utils';
@ -71,8 +72,11 @@ export default defineComponent({
show: Boolean,
overlay: Boolean,
duration: [Number, String],
overlayClass: UnknownProp,
overlayClass: unknownProp,
overlayStyle: Object as PropType<CSSProperties>,
closeOnClickAction: truthProp,
closeOnClickOverlay: truthProp,
closeOnClickOutside: truthProp,
offset: {
type: (Array as unknown) as PropType<[number, number]>,
default: () => [0, 8],
@ -97,18 +101,6 @@ export default defineComponent({
type: [String, Object] as PropType<TeleportProps['to']>,
default: 'body',
},
closeOnClickAction: {
type: Boolean,
default: true,
},
closeOnClickOverlay: {
type: Boolean,
default: true,
},
closeOnClickOutside: {
type: Boolean,
default: true,
},
},
emits: ['select', 'touchstart', 'update:show'],

View File

@ -1,41 +1,29 @@
import { PropType, CSSProperties, TeleportProps } from 'vue';
import { UnknownProp } from '../utils';
import { truthProp, unknownProp } from '../utils';
export const popupSharedProps = {
// whether to show popup
show: Boolean,
// z-index
zIndex: [Number, String],
// whether to show overlay
overlay: truthProp,
// transition duration
duration: [Number, String],
// teleport
teleport: [String, Object] as PropType<TeleportProps['to']>,
// prevent body scroll
lockScroll: truthProp,
// whether to lazy render
lazyRender: truthProp,
// overlay custom style
overlayStyle: Object as PropType<CSSProperties>,
// overlay custom class name
overlayClass: UnknownProp,
overlayClass: unknownProp,
// Initial rendering animation
transitionAppear: Boolean,
// whether to show overlay
overlay: {
type: Boolean,
default: true,
},
// prevent body scroll
lockScroll: {
type: Boolean,
default: true,
},
// whether to lazy render
lazyRender: {
type: Boolean,
default: true,
},
// whether to close popup when overlay is clicked
closeOnClickOverlay: {
type: Boolean,
default: true,
},
closeOnClickOverlay: truthProp,
};
export type PopupSharedPropKeys = Array<keyof typeof popupSharedProps>;

View File

@ -7,7 +7,7 @@ import {
onMounted,
defineComponent,
} from 'vue';
import { createNamespace, addUnit } from '../utils';
import { truthProp, createNamespace, addUnit } from '../utils';
import { useExpose } from '../composables/use-expose';
const [name, bem] = createNamespace('progress');
@ -20,6 +20,7 @@ export default defineComponent({
inactive: Boolean,
pivotText: String,
textColor: String,
showPivot: truthProp,
pivotColor: String,
trackColor: String,
strokeWidth: [Number, String],
@ -28,10 +29,6 @@ export default defineComponent({
required: true,
validator: (value: number | string) => value >= 0 && value <= 100,
},
showPivot: {
type: Boolean,
default: true,
},
},
setup(props) {

View File

@ -1,5 +1,5 @@
import { watch, defineComponent, ExtractPropTypes } from 'vue';
import { UnknownProp, createNamespace } from '../utils';
import { unknownProp, createNamespace } from '../utils';
import { useChildren } from '@vant/use';
import { useLinkField } from '../composables/use-link-field';
import { CheckerParent } from '../checkbox/Checker';
@ -12,7 +12,7 @@ const props = {
disabled: Boolean,
iconSize: [Number, String],
direction: String,
modelValue: UnknownProp,
modelValue: unknownProp,
checkedColor: String,
};

View File

@ -1,7 +1,7 @@
import { computed, defineComponent } from 'vue';
// Utils
import { addUnit, createNamespace, preventDefault } from '../utils';
import { addUnit, truthProp, createNamespace, preventDefault } from '../utils';
// Composables
import { useRefs } from '../composables/use-refs';
@ -40,6 +40,7 @@ export default defineComponent({
disabled: Boolean,
allowHalf: Boolean,
voidColor: String,
touchable: truthProp,
iconPrefix: String,
disabledColor: String,
modelValue: {
@ -58,10 +59,6 @@ export default defineComponent({
type: [Number, String],
default: 5,
},
touchable: {
type: Boolean,
default: true,
},
},
emits: ['change', 'update:modelValue'],

View File

@ -1,5 +1,5 @@
import { computed, PropType, ComputedRef, defineComponent } from 'vue';
import { createNamespace, ComponentInstance } from '../utils';
import { truthProp, createNamespace, ComponentInstance } from '../utils';
import { useChildren } from '@vant/use';
const [name, bem] = createNamespace('row');
@ -25,16 +25,13 @@ export default defineComponent({
name,
props: {
wrap: truthProp,
align: String as PropType<RowAlign>,
justify: String as PropType<RowJustify>,
tag: {
type: String as PropType<keyof HTMLElementTagNameMap>,
default: 'div',
},
wrap: {
type: Boolean,
default: true,
},
gutter: {
type: [Number, String],
default: 0,

View File

@ -4,6 +4,7 @@ import { ref, PropType, defineComponent } from 'vue';
import {
pick,
extend,
truthProp,
createNamespace,
preventDefault,
ComponentInstance,
@ -25,6 +26,7 @@ export default defineComponent({
props: extend({}, fieldProps, {
label: String,
clearable: truthProp,
actionText: String,
background: String,
showAction: Boolean,
@ -32,10 +34,6 @@ export default defineComponent({
type: String as PropType<SearchShape>,
default: 'square',
},
clearable: {
type: Boolean,
default: true,
},
leftIcon: {
type: String,
default: 'search',

View File

@ -1,7 +1,7 @@
import { PropType, defineComponent } from 'vue';
// Utils
import { createNamespace, extend, pick } from '../utils';
import { truthProp, createNamespace, extend, pick } from '../utils';
import { popupSharedProps, popupSharedPropKeys } from '../popup/shared';
// Components
@ -49,18 +49,12 @@ export default defineComponent({
title: String,
cancelText: String,
description: String,
closeOnPopstate: truthProp,
safeAreaInsetBottom: truthProp,
options: {
type: Array as PropType<ShareSheetOptions>,
default: () => [],
},
closeOnPopstate: {
type: Boolean,
default: true,
},
safeAreaInsetBottom: {
type: Boolean,
default: true,
},
}),
emits: ['cancel', 'select', 'update:show'],

View File

@ -1,5 +1,5 @@
import { PropType, defineComponent } from 'vue';
import { createNamespace, addUnit, getSizeStyle } from '../utils';
import { addUnit, truthProp, getSizeStyle, createNamespace } from '../utils';
const [name, bem] = createNamespace('skeleton');
const DEFAULT_ROW_WIDTH = '100%';
@ -12,20 +12,14 @@ export default defineComponent({
title: Boolean,
round: Boolean,
avatar: Boolean,
loading: truthProp,
animate: truthProp,
avatarSize: [Number, String],
titleWidth: [Number, String],
row: {
type: [Number, String],
default: 0,
},
loading: {
type: Boolean,
default: true,
},
animate: {
type: Boolean,
default: true,
},
avatarShape: {
type: String as PropType<'square' | 'round'>,
default: 'round',

View File

@ -4,6 +4,7 @@ import { ref, watch, computed, PropType, defineComponent } from 'vue';
import {
isDef,
addUnit,
truthProp,
resetScroll,
formatNumber,
getSizeStyle,
@ -39,6 +40,10 @@ export default defineComponent({
theme: String as PropType<StepperTheme>,
integer: Boolean,
disabled: Boolean,
showPlus: truthProp,
showMinus: truthProp,
showInput: truthProp,
longPress: truthProp,
allowEmpty: Boolean,
modelValue: [Number, String],
inputWidth: [Number, String],
@ -69,22 +74,6 @@ export default defineComponent({
type: [Number, String],
default: 1,
},
showPlus: {
type: Boolean,
default: true,
},
showMinus: {
type: Boolean,
default: true,
},
showInput: {
type: Boolean,
default: true,
},
longPress: {
type: Boolean,
default: true,
},
},
emits: [

View File

@ -1,5 +1,5 @@
import { PropType, CSSProperties, defineComponent } from 'vue';
import { createNamespace } from '../utils';
import { truthProp, createNamespace } from '../utils';
// Components
import { Icon } from '../icon';
@ -21,10 +21,7 @@ export default defineComponent({
buttonText: String,
buttonColor: String,
suffixLabel: String,
safeAreaInsetBottom: {
type: Boolean,
default: true,
},
safeAreaInsetBottom: truthProp,
decimalLength: {
type: [Number, String],
default: 2,

View File

@ -17,6 +17,7 @@ import {
import {
range,
isHidden,
truthProp,
preventDefault,
createNamespace,
ComponentInstance,
@ -37,15 +38,15 @@ const [name, bem] = createNamespace('swipe');
export const SWIPE_KEY = Symbol(name);
const props = {
loop: truthProp,
width: [Number, String],
height: [Number, String],
vertical: Boolean,
touchable: truthProp,
lazyRender: Boolean,
indicatorColor: String,
loop: {
type: Boolean,
default: true,
},
showIndicators: truthProp,
stopPropagation: truthProp,
autoplay: {
type: [Number, String],
default: 0,
@ -54,22 +55,10 @@ const props = {
type: [Number, String],
default: 500,
},
touchable: {
type: Boolean,
default: true,
},
initialSwipe: {
type: [Number, String],
default: 0,
},
showIndicators: {
type: Boolean,
default: true,
},
stopPropagation: {
type: Boolean,
default: true,
},
};
export type SwipeToOptions = {

View File

@ -1,5 +1,5 @@
import { defineComponent } from 'vue';
import { createNamespace, addUnit, UnknownProp } from '../utils';
import { createNamespace, addUnit, unknownProp } from '../utils';
import { useLinkField } from '../composables/use-link-field';
import { Loading } from '../loading';
@ -12,15 +12,15 @@ export default defineComponent({
size: [Number, String],
loading: Boolean,
disabled: Boolean,
modelValue: UnknownProp,
modelValue: unknownProp,
activeColor: String,
inactiveColor: String,
activeValue: {
type: UnknownProp,
type: unknownProp,
default: true as unknown,
},
inactiveValue: {
type: UnknownProp,
type: unknownProp,
default: false as unknown,
},
},

View File

@ -8,7 +8,7 @@ import {
} from 'vue';
// Utils
import { createNamespace, extend, UnknownProp } from '../utils';
import { createNamespace, extend, unknownProp } from '../utils';
import { TABS_KEY, TabsProvide } from '../tabs/Tabs';
// Composables
@ -29,7 +29,7 @@ export default defineComponent({
badge: [Number, String],
title: String,
disabled: Boolean,
titleClass: UnknownProp,
titleClass: unknownProp,
titleStyle: [String, Object] as PropType<string | CSSProperties>,
}),

View File

@ -1,7 +1,7 @@
import { ref, PropType, defineComponent, ExtractPropTypes } from 'vue';
// Utils
import { createNamespace, getZIndexStyle } from '../utils';
import { truthProp, createNamespace, getZIndexStyle } from '../utils';
import { BORDER_TOP_BOTTOM } from '../utils/constant';
import { callInterceptor, Interceptor } from '../utils/interceptor';
@ -15,6 +15,8 @@ export const TABBAR_KEY = Symbol(name);
const props = {
route: Boolean,
fixed: truthProp,
border: truthProp,
zIndex: [Number, String],
placeholder: Boolean,
activeColor: String,
@ -24,14 +26,6 @@ const props = {
type: [Number, String],
default: 0,
},
border: {
type: Boolean,
default: true,
},
fixed: {
type: Boolean,
default: true,
},
safeAreaInsetBottom: {
type: Boolean as PropType<boolean | null>,
default: null,

View File

@ -9,8 +9,8 @@ import {
onActivated,
CSSProperties,
defineComponent,
ComponentPublicInstance,
ExtractPropTypes,
ComponentPublicInstance,
} from 'vue';
// Utils
@ -19,6 +19,7 @@ import {
addUnit,
isHidden,
unitToPx,
truthProp,
getVisibleTop,
getElementTop,
createNamespace,
@ -58,9 +59,11 @@ const props = {
border: Boolean,
sticky: Boolean,
animated: Boolean,
ellipsis: truthProp,
swipeable: Boolean,
scrollspy: Boolean,
background: String,
lazyRender: truthProp,
lineWidth: [Number, String],
lineHeight: [Number, String],
beforeChange: Function as PropType<Interceptor>,
@ -74,10 +77,6 @@ const props = {
type: [Number, String],
default: 0,
},
ellipsis: {
type: Boolean,
default: true,
},
duration: {
type: [Number, String],
default: 0.3,
@ -86,10 +85,6 @@ const props = {
type: [Number, String],
default: 0,
},
lazyRender: {
type: Boolean,
default: true,
},
swipeThreshold: {
type: [Number, String],
default: 5,

View File

@ -1,5 +1,5 @@
import { CSSProperties, PropType, Transition, defineComponent } from 'vue';
import { createNamespace } from '../utils';
import { truthProp, createNamespace } from '../utils';
import { Icon } from '../icon';
const [name, bem] = createNamespace('tag');
@ -12,6 +12,7 @@ export default defineComponent({
props: {
size: String,
mark: Boolean,
show: truthProp,
color: String,
plain: Boolean,
round: Boolean,
@ -21,10 +22,6 @@ export default defineComponent({
type: String as PropType<TagType>,
default: 'default',
},
show: {
type: Boolean,
default: true,
},
},
emits: ['close'],

View File

@ -8,7 +8,7 @@ import {
} from 'vue';
// Utils
import { createNamespace, isDef, UnknownProp } from '../utils';
import { createNamespace, isDef, unknownProp } from '../utils';
import { lockClick } from './lock-click';
// Components
@ -30,11 +30,11 @@ export default defineComponent({
overlay: Boolean,
message: [Number, String],
iconSize: [Number, String],
className: UnknownProp,
className: unknownProp,
iconPrefix: String,
loadingType: String as PropType<LoadingType>,
forbidClick: Boolean,
overlayClass: UnknownProp,
overlayClass: unknownProp,
overlayStyle: Object as PropType<CSSProperties>,
closeOnClick: Boolean,
closeOnClickOverlay: Boolean,

View File

@ -5,6 +5,7 @@ import {
pick,
extend,
isPromise,
truthProp,
getSizeStyle,
ComponentInstance,
} from '../utils';
@ -60,11 +61,15 @@ export default defineComponent({
disabled: Boolean,
lazyLoad: Boolean,
uploadText: String,
deletable: truthProp,
afterRead: Function as PropType<UploaderAfterRead>,
showUpload: truthProp,
beforeRead: Function as PropType<UploaderBeforeRead>,
beforeDelete: Function as PropType<Interceptor>,
previewSize: [Number, String],
previewImage: truthProp,
previewOptions: Object as PropType<ImagePreviewOptions>,
previewFullImage: truthProp,
name: {
type: [Number, String],
default: '',
@ -85,22 +90,6 @@ export default defineComponent({
type: [Number, String],
default: Number.MAX_VALUE,
},
deletable: {
type: Boolean,
default: true,
},
showUpload: {
type: Boolean,
default: true,
},
previewImage: {
type: Boolean,
default: true,
},
previewFullImage: {
type: Boolean,
default: true,
},
imageFit: {
type: String as PropType<ImageFit>,
default: 'cover',

View File

@ -12,7 +12,7 @@ import { Loading } from '../loading';
export default defineComponent({
props: {
name: [String, Number],
name: [Number, String],
index: Number,
imageFit: String as PropType<ImageFit>,
lazyLoad: Boolean,

View File

@ -6,8 +6,12 @@ export const extend = Object.assign;
export const inBrowser = typeof window !== 'undefined';
// unknown type for Vue prop
export const UnknownProp = (null as unknown) as PropType<unknown>;
// PropTypes
export const unknownProp = (null as unknown) as PropType<unknown>;
export const truthProp = {
type: Boolean,
default: true as const,
};
// eslint-disable-next-line
export type ComponentInstance = ComponentPublicInstance<{}, any>;