feat: add @vant/use

This commit is contained in:
chenjiahan 2020-09-10 21:03:53 +08:00
parent 14c1d4ea77
commit dbc6b92868
5 changed files with 1912 additions and 0 deletions

View File

@ -0,0 +1,23 @@
{
"name": "@vant/use",
"version": "0.0.1-beta.0",
"description": "Vant composition api",
"main": "lib/index.js",
"module": "es/index.js",
"typings": "lib/index.d.ts",
"sideEffects": false,
"scripts": {
"dev": "tsc -m esNext --outDir es --watch",
"build": "tsc && tsc -m esNext --outDir es"
},
"publishConfig": {
"access": "public"
},
"license": "MIT",
"repository": "https://github.com/youzan/vant/tree/dev/packages/vant-use",
"devDependencies": {
"release-it": "^14.0.2",
"typescript": "^4.0.2",
"vue": "^3.0.0-rc.10"
}
}

View File

@ -0,0 +1 @@
export { useToggle } from './useToggle';

View File

@ -0,0 +1,10 @@
import { ref } from 'vue';
export function useToggle(defaultValue = false) {
const state = ref(defaultValue);
const toggle = (value = !state.value) => {
state.value = value;
};
return [state, toggle];
}

View File

@ -0,0 +1,14 @@
{
"compilerOptions": {
"target": "ES5",
"outDir": "./lib",
"module": "CommonJS",
"strict": true,
"declaration": true,
"skipLibCheck": true,
"esModuleInterop": true,
"moduleResolution": "Node",
"lib": ["esnext"]
},
"include": ["src/**/*"]
}

1864
packages/vant-use/yarn.lock Normal file

File diff suppressed because it is too large Load Diff