-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from vusion/task-2814552607417856-cust_communi…
…ty_icon_image-hanshijie-240226 feat: 新增类型:带遮罩层的图片,对应的schema为:localImg://imageURL-mask_background_image
- Loading branch information
Showing
9 changed files
with
199 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
## 1.0.3 | ||
|
||
Associated Task: [#281455](https://projectmanage.netease-official.lcap.163yun.com/dashboard/TaskDetail?id=2814552607417856) | ||
|
||
### ✨Features | ||
|
||
- [36a85cb](https://github.com/vusion/cloud-ui-materials/commit/36a85cb81dcdae782038830ad10d1bfb98e5ded5) Thanks [ncqwer](https://github.com/ncqwer) ! - 新增类型:带遮罩层的图片,对应的schema为:localImg://imageURL-mask_background_image | ||
|
||
### 🚨BREAKING CHANGES | ||
|
||
- [36a85cb](https://github.com/vusion/cloud-ui-materials/commit/36a85cb81dcdae782038830ad10d1bfb98e5ded5) Thanks [ncqwer](https://github.com/ncqwer) ! - 当前组件的内部使用的u-image默认的图片默认使用图片为fit为fill | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...s/cust/cust_community_icon_image/components/cust-community-icon-image/image-with-mask.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<template> | ||
<div :class="$style.root"> | ||
<u-image :src="img" fit="fill"></u-image> | ||
<div v-if="maskStyle" :class="$style.mask" :style="maskStyle"></div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'custom-community-icon-with-mask', | ||
props: { | ||
img: { | ||
type: String, | ||
default: undefined, | ||
}, | ||
mask: { | ||
type: String, | ||
default: '', | ||
}, | ||
}, | ||
computed: { | ||
maskStyle() { | ||
console.log(this.$attrs); | ||
if (!this.mask) return null; | ||
return { | ||
'background-image': this.mask, | ||
}; | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style module> | ||
.root { | ||
position: relative; | ||
display: inline-block; | ||
overflow: hidden; | ||
width: var(--image-width); | ||
height: var(--image-height); | ||
color: #fff; | ||
} | ||
.root [class^='u-image__'] { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
.mask { | ||
position: absolute; | ||
pointer-events: none; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
} | ||
</style> |
76 changes: 38 additions & 38 deletions
76
packages/cust/cust_community_icon_image/components/cust-community-icon-image/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,50 @@ | ||
<template> | ||
<div :class="$style.root" :style="rootStyle"> | ||
<svg aria-hidden="true" :class="$style.icon"><use :xlink:href="iconName"></use></svg> | ||
</div> | ||
<div :class="$style.root" :style="rootStyle"> | ||
<svg aria-hidden="true" :class="$style.icon"> | ||
<use :xlink:href="iconName"></use> | ||
</svg> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'custom-community-icon', | ||
props: { | ||
backgroundImg: { | ||
type: String, | ||
default: undefined, | ||
}, | ||
icon: { | ||
type: String, | ||
default: 'youjian', | ||
} | ||
}, | ||
computed: { | ||
iconName(){ | ||
return `#others-${this.icon}`; | ||
}, | ||
rootStyle(){ | ||
return { | ||
'background-image': this.backgroundImg, | ||
}; | ||
} | ||
} | ||
name: 'custom-community-icon', | ||
props: { | ||
backgroundImg: { | ||
type: String, | ||
default: undefined, | ||
}, | ||
icon: { | ||
type: String, | ||
default: 'youjian', | ||
}, | ||
}, | ||
computed: { | ||
iconName() { | ||
return `#others-${this.icon}`; | ||
}, | ||
rootStyle() { | ||
return { | ||
'background-image': this.backgroundImg, | ||
}; | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style module> | ||
.root{ | ||
position: relative; | ||
display: inline-block; | ||
overflow: hidden; | ||
width: var(--image-width); | ||
height: var(--image-height); | ||
color: #fff; | ||
.root { | ||
position: relative; | ||
display: inline-block; | ||
overflow: hidden; | ||
width: var(--image-width); | ||
height: var(--image-height); | ||
color: #fff; | ||
} | ||
.icon{ | ||
width: 100%; | ||
height: 100%; | ||
fill: currentColor; | ||
.icon { | ||
width: 100%; | ||
height: 100%; | ||
fill: currentColor; | ||
} | ||
</style> | ||
</style> |
67 changes: 52 additions & 15 deletions
67
packages/cust/cust_community_icon_image/components/cust-community-icon-image/wrap.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,77 @@ | ||
import CustCommunityIconImage from './index.vue'; | ||
import CustCommunityIconImageWithMask from './image-with-mask.vue'; | ||
|
||
const REG = /^local:\/\/(\S+)~(.+)$/; | ||
const REG = /^(local(?:Img)?):\/\/(\S+)~(.+)$/; | ||
export default { | ||
name: 'cust-community-icon-image', | ||
inheritAttrs: false, | ||
|
||
props: { | ||
src: { | ||
type: String, | ||
default: 'local://wenjianjia~linear-gradient(317deg, #89B1FF 3%, #8FD7FF 100%)', | ||
default: | ||
'localImg:////test-lcpapp-static.nos-eastchina1.126.net/assets/cloud-ui/1.jpg~linear-gradient(90deg, #5B96CC -2%, rgba(91, 150, 204, 0) 120%)', | ||
}, | ||
targetStyle: { | ||
type: Object, | ||
default: () => ({}), | ||
}, | ||
}, | ||
render(createElement) { | ||
const src = this.src || 'local://wenjianjia~linear-gradient(317deg, #89B1FF 3%, #8FD7FF 100%)'; | ||
const src = | ||
this.src || | ||
'local://wenjianjia~linear-gradient(317deg, #89B1FF 3%, #8FD7FF 100%)'; | ||
const isLocalIconResult = REG.exec(src); | ||
// console.log('🚀 ~ file: wrap.js:24 ~ render ~ src:', src); | ||
if (isLocalIconResult) { | ||
return createElement(CustCommunityIconImage, { | ||
props: Object.assign({}, this.$attrs, { backgroundImg: isLocalIconResult[2], icon: isLocalIconResult[1] }), | ||
attrs: { | ||
'vusion-node-tag': this.$attrs['vusion-node-tag'], | ||
'vusion-node-path': this.$attrs['vusion-node-path'], | ||
}, | ||
on: this.$listeners, | ||
slots: this.$slots, | ||
scopedSlots: this.$scopedSlots, | ||
}); | ||
const protocol = isLocalIconResult[1]; | ||
if (protocol === 'local') | ||
return createElement(CustCommunityIconImage, { | ||
props: Object.assign({}, this.$attrs, { | ||
icon: isLocalIconResult[2], | ||
backgroundImg: isLocalIconResult[3], | ||
}), | ||
attrs: { | ||
'vusion-node-tag': this.$attrs['vusion-node-tag'], | ||
'vusion-node-path': this.$attrs['vusion-node-path'], | ||
}, | ||
on: this.$listeners, | ||
slots: this.$slots, | ||
scopedSlots: this.$scopedSlots, | ||
style: this.targetStyle.icon, | ||
}); | ||
if (protocol === 'localImg') { | ||
return createElement(CustCommunityIconImageWithMask, { | ||
props: Object.assign({ fill: 'hsj' }, this.$attrs, { | ||
img: `${isLocalIconResult[2]}`, | ||
mask: isLocalIconResult[3], | ||
}), | ||
attrs: { | ||
'vusion-node-tag': this.$attrs['vusion-node-tag'], | ||
'vusion-node-path': this.$attrs['vusion-node-path'], | ||
}, | ||
on: this.$listeners, | ||
slots: this.$slots, | ||
scopedSlots: this.$scopedSlots, | ||
style: this.targetStyle.imgWithMask, | ||
}); | ||
} | ||
} | ||
return createElement('u-image', { | ||
props: Object.assign({}, this.$attrs, { src: this.src }), | ||
props: Object.assign({}, this.$attrs, { | ||
src: this.src, | ||
fit: 'fill', | ||
}), | ||
style: { | ||
width: '100%', | ||
}, | ||
attrs: { | ||
'vusion-node-tag': this.$attrs['vusion-node-tag'], | ||
'vusion-node-path': this.$attrs['vusion-node-path'], | ||
}, | ||
on: this.$listeners, | ||
slots: this.$slots, | ||
scopedSlots: this.$scopedSlots, | ||
style: this.targetStyle.img, | ||
}); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Plugin-Version: 1.0.0 | ||
Library-Type: Frontend | ||
Metadata-File: usage.json | ||
packages/extension/[email protected].0/dist-theme/demo.html: dist-theme/demo.html | ||
packages/extension/[email protected].0/dist-theme/index.js: dist-theme/index.js | ||
packages/extension/[email protected].0/dist-theme/index.js.map: dist-theme/index.js.map | ||
packages/extension/[email protected].3/dist-theme/demo.html: dist-theme/demo.html | ||
packages/extension/[email protected].3/dist-theme/index.js: dist-theme/index.js | ||
packages/extension/[email protected].3/dist-theme/index.js.map: dist-theme/index.js.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
## 1.0.4 | ||
|
||
Associated Task: [#281100](https://projectmanage.netease-official.lcap.163yun.com/dashboard/TaskDetail?id=2811004089143552) | ||
|
||
### ✨Features | ||
|
||
- [1c8df31](https://github.com/vusion/cloud-ui-materials/commit/1c8df31965da7537a3a409caad5937f591984d64) Thanks [ncqwer](https://github.com/ncqwer) ! - 变更其它依赖库 | ||
|