mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
types: improve ref typing
This commit is contained in:
parent
eda4de93ae
commit
683cc88c54
@ -31,7 +31,7 @@ export default defineComponent({
|
||||
emits: ['click', 'toggle'],
|
||||
|
||||
setup(props, { emit, slots }) {
|
||||
const iconRef = ref();
|
||||
const iconRef = ref<HTMLElement>();
|
||||
|
||||
const getParentProp = (name: string) => {
|
||||
if (props.parent) {
|
||||
@ -60,7 +60,7 @@ export default defineComponent({
|
||||
const onClick = (event: MouseEvent) => {
|
||||
const { target } = event;
|
||||
const icon = iconRef.value;
|
||||
const iconClicked = icon === target || icon.contains(target);
|
||||
const iconClicked = icon === target || icon!.contains(target as Node);
|
||||
|
||||
if (!disabled.value && (iconClicked || !props.labelDisabled)) {
|
||||
emit('toggle');
|
||||
|
@ -39,7 +39,7 @@ export default createComponent({
|
||||
setup(props, { emit, slots }) {
|
||||
const error = ref(false);
|
||||
const loading = ref(true);
|
||||
const imageRef = ref();
|
||||
const imageRef = ref<HTMLElement>();
|
||||
|
||||
const style = computed(() => {
|
||||
const style: CSSProperties = {};
|
||||
|
Loading…
x
Reference in New Issue
Block a user