mirror of
https://github.com/directus/directus.git
synced 2026-01-28 20:27:55 -05:00
Render href attributes on router-link (#7456)
While props set to null aren't rendered to the DOM, they are passed to other components as attributes if not defined as props. This prevents vue-router from setting the attribute itself.
This commit is contained in:
committed by
GitHub
parent
9d9e2800d1
commit
a63809c21f
@@ -3,7 +3,7 @@
|
||||
<slot name="prepend-outer" />
|
||||
<component
|
||||
:is="component"
|
||||
:ref="component === 'a' ? 'noopener noreferer' : null"
|
||||
:ref="component === 'a' ? 'noopener noreferer' : undefined"
|
||||
v-focus="autofocus"
|
||||
:download="download"
|
||||
class="button"
|
||||
@@ -23,9 +23,9 @@
|
||||
]"
|
||||
:type="type"
|
||||
:disabled="disabled"
|
||||
:to="to"
|
||||
:to="to !== '' ? to : undefined"
|
||||
:href="href"
|
||||
:target="component === 'a' ? '_blank' : null"
|
||||
:target="component === 'a' ? '_blank' : undefined"
|
||||
@click="onClick"
|
||||
>
|
||||
<span class="content" :class="{ invisible: loading }">
|
||||
@@ -89,7 +89,7 @@ export default defineComponent({
|
||||
},
|
||||
href: {
|
||||
type: String,
|
||||
default: null,
|
||||
default: undefined,
|
||||
},
|
||||
active: {
|
||||
type: Boolean,
|
||||
@@ -109,7 +109,7 @@ export default defineComponent({
|
||||
},
|
||||
value: {
|
||||
type: [Number, String],
|
||||
default: null,
|
||||
default: undefined,
|
||||
},
|
||||
dashed: {
|
||||
type: Boolean,
|
||||
@@ -126,7 +126,7 @@ export default defineComponent({
|
||||
},
|
||||
download: {
|
||||
type: String,
|
||||
default: null,
|
||||
default: undefined,
|
||||
},
|
||||
...sizeProps,
|
||||
},
|
||||
@@ -137,7 +137,7 @@ export default defineComponent({
|
||||
const { route: linkRoute, isActive, isExactActive } = useLink(props);
|
||||
const sizeClass = useSizeClass(props);
|
||||
|
||||
const component = computed<'a' | 'router-link' | 'button'>(() => {
|
||||
const component = computed(() => {
|
||||
if (props.disabled) return 'button';
|
||||
if (notEmpty(props.href)) return 'a';
|
||||
if (props.to) return 'router-link';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<component
|
||||
:is="component"
|
||||
class="v-list-item"
|
||||
:to="to"
|
||||
:to="to !== '' ? to : undefined"
|
||||
:class="{
|
||||
active: isActiveRoute,
|
||||
dense,
|
||||
@@ -14,7 +14,7 @@
|
||||
}"
|
||||
:href="href"
|
||||
:download="download"
|
||||
:target="component === 'a' ? '_blank' : null"
|
||||
:target="component === 'a' ? '_blank' : undefined"
|
||||
@click="onClick"
|
||||
>
|
||||
<slot />
|
||||
@@ -43,7 +43,7 @@ export default defineComponent({
|
||||
},
|
||||
href: {
|
||||
type: String,
|
||||
default: null,
|
||||
default: undefined,
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
@@ -71,7 +71,7 @@ export default defineComponent({
|
||||
},
|
||||
download: {
|
||||
type: String,
|
||||
default: null,
|
||||
default: undefined,
|
||||
},
|
||||
value: {
|
||||
type: [String, Number],
|
||||
@@ -88,7 +88,7 @@ export default defineComponent({
|
||||
|
||||
const { route: linkRoute, isActive, isExactActive } = useLink(props);
|
||||
|
||||
const component = computed<string>(() => {
|
||||
const component = computed(() => {
|
||||
if (props.to) return 'router-link';
|
||||
if (props.href) return 'a';
|
||||
return 'li';
|
||||
|
||||
@@ -52,8 +52,8 @@ export default defineComponent({
|
||||
modules.value
|
||||
.map((module: ModuleConfig) => ({
|
||||
...module,
|
||||
href: module.link || null,
|
||||
to: module.link === undefined ? `/${module.id}` : null,
|
||||
href: module.link,
|
||||
to: module.link === undefined ? `/${module.id}` : '',
|
||||
}))
|
||||
.filter((module: ModuleConfig) => {
|
||||
if (module.hidden !== undefined && unref(module.hidden) === true) {
|
||||
|
||||
Reference in New Issue
Block a user