HTML相对路径--上级目录及下级目录的写法

如何表示上级目录

../表示源文件所在目录的上一级目录,../../表示源文件所在目录的上上级目录,以此类推。

假设info.html路径是:c:/Inetpub/wwwroot/sites/blabla/info.html
假设index.html路径是:c:/Inetpub/wwwroot/sites/index.html
在info.html加入index.html超链接的代码应该这样写:

<a href = "../index.html">index.html</a>

 

假设info.html路径是:c:/Inetpub/wwwroot/sites/blabla/info.html
假设index.html路径是:c:/Inetpub/wwwroot/index.html
在info.html加入index.html超链接的代码应该这样写:

<a href = "../../index.html">index.html</a>

 

假设info.html路径是:c:/Inetpub/wwwroot/sites/blabla/info.html
假设index.html路径是:c:/Inetpub/wwwroot/sites/wowstory/index.html
在info.html加入index.html超链接的代码应该这样写:

<a href = "../wowstory/index.html">index.html</a>
 
 

如何表示下级目录

引用下级目录的文件,直接写下级目录文件的路径即可。

假设info.html路径是:c:/Inetpub/wwwroot/sites/blabla/info.html 假设index.html路径是:c:/Inetpub/wwwroot/sites/blabla/html/index.html 在info.html加入index.html超链接的代码应该这样写:

<a href = "html/index.html">index.html</a>

 

假设info.html路径是:c:/Inetpub/wwwroot/sites/blabla/info.html
假设index.html路径是:c:/Inetpub/wwwroot/sites/blabla/html/tutorials/index.html
在info.html加入index.html超链接的代码应该这样写:

<a href = "html/tutorials/index.html">index.html</a>
  • 8
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,针对您的问题,您可以通过在 el-select 的 change 事件中获取当前选中的 id,然后根据 id 去后端请求对应的下级选项数据,最后将数据赋值给下级的 el-select 组件即可。 以下是一个示例代码: ```html <template> <div> <el-select v-model="selectedId" placeholder="请选择" @change="loadSubOptions"> <el-option v-for="option in options" :key="option.id" :label="option.label" :value="option.id" /> </el-select> <el-select v-model="selectedSubId" placeholder="请选择"> <el-option v-for="subOption in subOptions" :key="subOption.id" :label="subOption.label" :value="subOption.id" /> </el-select> </div> </template> <script> export default { data() { return { selectedId: '', selectedSubId: '', options: [ { id: 1, label: '选项一' }, { id: 2, label: '选项二' }, { id: 3, label: '选项三' } ], subOptions: [] } }, methods: { async loadSubOptions() { // 根据当前选中的 id,请求对应的下级选项数据 const response = await this.$http.get(`/api/options/${this.selectedId}/sub-options`) this.subOptions = response.data } } } </script> ``` 在上面的示例代码中,我们定义了两个 el-select 组件,一个用于选择上级选项,一个用于显示下级选项。在上级 el-select 的 change 事件中,我们调用了 loadSubOptions 方法,该方法根据当前选中的 id 去后端请求对应的下级选项数据,并将数据赋值给 subOptions 属性。 在下级 el-select 中,我们通过 v-for 指令遍历 subOptions 数组,并将每个选项渲染成一个 el-option 组件。 希望这个回答能够帮到您,如果还有其他问题,请随时提出。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值