Compare commits

..

No commits in common. "aa50e59da96c04663162a5cd2cfb1071720011b2" and "8bc55c8b32701f8c10347be81ed73c341c00135b" have entirely different histories.

15 changed files with 2001 additions and 36 deletions

View File

@ -16,8 +16,7 @@ const DEFAULT_CONFIG = {
setupFilesAfterEnv: [JEST_SETUP_FILE],
moduleFileExtensions: ['js', 'jsx', 'vue', 'ts', 'tsx'],
transform: {
'\\.(js|jsx|ts|tsx|vue)$':
'<rootDir>/node_modules/@vant/cli/cjs/jest.transformer.cjs',
'\\.(js|jsx|ts|tsx|vue)$': '<rootDir>/node_modules/@vant/cli/cjs/jest.transformer.cjs',
},
transformIgnorePatterns: ['/node_modules/(?!(@vant/cli))/'],
snapshotSerializers: ['jest-serializer-html'],

View File

@ -27,12 +27,12 @@ button
| transform | boolean | 防止预览区内 fixed 定位的元素飞出预览区 |
| inline | boolean | 只显示组件本身,不显示预览区边框和代码 |
### `compact`
```html
<demo-code compact>./demo/MyDemo.vue</demo-code>
```
![image](https://user-images.githubusercontent.com/5093611/111076728-77cc5d00-8528-11eb-85f1-e7217344ab14.png)
### `transform`
@ -40,7 +40,6 @@ button
```html
<demo-code transform>./demo/MyDemo.vue</demo-code>
```
![image](https://user-images.githubusercontent.com/5093611/111076799-d5f94000-8528-11eb-973f-c9d69f91d2a7.png)
### `inline`
@ -48,7 +47,6 @@ button
```html
<demo-code inline>./demo/MyDemo.vue</demo-code>
```
![image](https://user-images.githubusercontent.com/5093611/111076845-15c02780-8529-11eb-9cfb-76c9b25dc2a2.png)
### 去除手机模拟器
@ -81,4 +79,5 @@ module.exports = {
},
},
};
```
```

View File

@ -18,9 +18,10 @@
<% if (baiduAnalytics) { %>
<script>
var _hmt = _hmt || [];
(function () {
(function() {
var hm = document.createElement('script');
hm.src = 'https://hm.baidu.com/hm.js?<%= baiduAnalytics.seed %>';
hm.src =
'https://hm.baidu.com/hm.js?<%= baiduAnalytics.seed %>';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(hm, s);
})();

View File

@ -12,7 +12,8 @@
export default {
data() {
return {
path: 'M296.114 508.035c-3.22-13.597.473-28.499 11.079-39.105l333.912-333.912c16.271-16.272 42.653-16.272 58.925 0s16.272 42.654 0 58.926L395.504 498.47l304.574 304.574c16.272 16.272 16.272 42.654 0 58.926s-42.654 16.272-58.926 0L307.241 528.058a41.472 41.472 0 0 1-11.127-20.023z',
path:
'M296.114 508.035c-3.22-13.597.473-28.499 11.079-39.105l333.912-333.912c16.271-16.272 42.653-16.272 58.925 0s16.272 42.654 0 58.926L395.504 498.47l304.574 304.574c16.272 16.272 16.272 42.654 0 58.926s-42.654 16.272-58.926 0L307.241 528.058a41.472 41.472 0 0 1-11.127-20.023z',
};
},

View File

@ -1,4 +1,4 @@
import { defineComponent } from 'vue';
import { defineComponent } from 'vue'
export default defineComponent({
name: 'App',
@ -7,6 +7,6 @@ export default defineComponent({
<>
<h1>App</h1>
</>
);
},
});
)
}
})

View File

@ -5,15 +5,15 @@
</template>
<script>
const a = 1;
a = 1;
const a = 1
a = 1
export default {
data() {
return {
arr: [1, 2, 3],
};
},
};
arr: [1, 2, 3]
}
}
}
</script>
<style></style>

View File

@ -1,2 +1,2 @@
const a = b + 1;
export default a;
const a = b + 1
export default a

View File

@ -1,7 +1,7 @@
declare const config: {
name: string;
basic: string[];
outline: string[];
filled: string[];
name: string;
basic: string[];
outline: string[];
filled: string[];
};
export default config;

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@ export type VueAttribute = {
name: string;
default: string;
description: string;
options: string[];
options: string[]
value: {
kind: 'expression';
type: string;

View File

@ -21,8 +21,8 @@ export function normalizePath(path: string): string {
return path.replace(/\\/g, '/');
}
// `default` `primary` -> ['default', 'primary']
// `default` `primary` -> ['default', 'primary']
export function formatOptions(options?: string) {
if (!options) return [];
return options.replace(/`/g, '').split(' ');
if (!options) return []
return options.replace(/`/g, '').split(' ')
}

View File

@ -6,8 +6,9 @@ export type CustomFieldInjectionValue = {
validateWithTrigger: (trigger: 'onBlur' | 'onChange' | 'onSubmit') => void;
};
export const CUSTOM_FIELD_INJECTION_KEY: InjectionKey<CustomFieldInjectionValue> =
Symbol('van-field');
export const CUSTOM_FIELD_INJECTION_KEY: InjectionKey<CustomFieldInjectionValue> = Symbol(
'van-field'
);
export function useCustomFieldValue(customValue: () => unknown) {
const field = inject(CUSTOM_FIELD_INJECTION_KEY, null);

View File

@ -20,11 +20,11 @@ export default {
setup() {
const root = ref();
onMounted(() => {
onMounted(()=>{
const rect = useRect(root);
console.log(rect); // -> 元素的大小及其相对于视口的位置
});
})
return { root };
},
};

View File

@ -66,7 +66,7 @@
"dependencies": {
"@vant/icons": "^1.7.1",
"@vant/popperjs": "^1.1.0",
"@vant/use": "^1.3.5"
"@vant/use": "^1.3.4"
},
"peerDependencies": {
"vue": "^3.0.0"

2
pnpm-lock.yaml generated
View File

@ -54,7 +54,7 @@ importers:
'@vant/eslint-config': workspace:*
'@vant/icons': ^1.7.1
'@vant/popperjs': ^1.1.0
'@vant/use': ^1.3.5
'@vant/use': ^1.3.4
'@vue/runtime-core': ^3.2.27
'@vue/test-utils': ^2.0.0-rc.16
typescript: ~4.5.2