mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-12-03 00:52:08 +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'],
|
emits: ['click', 'toggle'],
|
||||||
|
|
||||||
setup(props, { emit, slots }) {
|
setup(props, { emit, slots }) {
|
||||||
const iconRef = ref();
|
const iconRef = ref<HTMLElement>();
|
||||||
|
|
||||||
const getParentProp = (name: string) => {
|
const getParentProp = (name: string) => {
|
||||||
if (props.parent) {
|
if (props.parent) {
|
||||||
@ -60,7 +60,7 @@ export default defineComponent({
|
|||||||
const onClick = (event: MouseEvent) => {
|
const onClick = (event: MouseEvent) => {
|
||||||
const { target } = event;
|
const { target } = event;
|
||||||
const icon = iconRef.value;
|
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)) {
|
if (!disabled.value && (iconClicked || !props.labelDisabled)) {
|
||||||
emit('toggle');
|
emit('toggle');
|
||||||
|
|||||||
@ -39,7 +39,7 @@ export default createComponent({
|
|||||||
setup(props, { emit, slots }) {
|
setup(props, { emit, slots }) {
|
||||||
const error = ref(false);
|
const error = ref(false);
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const imageRef = ref();
|
const imageRef = ref<HTMLElement>();
|
||||||
|
|
||||||
const style = computed(() => {
|
const style = computed(() => {
|
||||||
const style: CSSProperties = {};
|
const style: CSSProperties = {};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user