mirror of
https://github.com/youzan/vant.git
synced 2025-10-21 11:17:41 +00:00
types: improve ref typing
This commit is contained in:
@@ -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 = {};
|
||||||
|
Reference in New Issue
Block a user