我所要达到的目标是:
在Post.vue中显示动态链接中的图像,该链接遵循PostLayout.vue的布局
在PostLayout.vue中,我有一个名为postFeaturedImage,在插槽内有一个,我想用图像作为它的背景。
我使用的是: Laravel,InertiaJS,Vue 3
我的密码是:
Post.vue:
<template>
<PostLayout>
<template #postfeaturedImage>
<!-- Here I want to display the imag
在SPA方法中,我使用vuepress作为静态生成页面和动态页面的混合解决方案。动态数据源是一个大型的数据库服务器,因此不能使用vurepress 1.x中引入的特性。这意味着使用enhanceApp.js添加了动态路由,如下所示。动态页面通过扩展布局呈现,以共享相同的页面结构(页眉、页脚)。
// Foo is a layout component extends from Layout.vue
import Foo from './layouts/Foo.vue'
export default ({
Vue, // the version of Vue being
我使用JavaScript动态创建了一个"div“元素,并向其添加了几个元素。除了图像元素之外,所有的元素都被正确添加了,它只显示"alt“属性,而不显示图像本身。是什么导致了这个问题? let div = document.createElement('div')
// Elements are being properly added here
var img = document.createElement('img')
img.setAttribute('src', '../assets/Images/I