初始化
This commit is contained in:
10
utils/directive.js
Normal file
10
utils/directive.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import Vue from 'vue'
|
||||
|
||||
// 注册全局自定义指令
|
||||
Vue.directive('basesrc', {
|
||||
inserted(el, binding) {
|
||||
const originalUrl = binding.value // 获取原始图片地址
|
||||
const newUrl = 'https://jx.xiaolinghou.com/webtest/static/' + originalUrl // 修改后的图片地址
|
||||
el.setAttribute('src', newUrl) // 设置新的地址
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user