add image asset handler plugin
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import { Group, Panel, coordinator, text, gravity, Color, LayoutSpec, log, vlayout, scroller, layoutConfig, image, ScaleType, Image } from "doric";
|
||||
import { colors, label } from "./utils";
|
||||
import { img_base64 } from "./image_base64";
|
||||
|
||||
const imageUrl = 'https://img.zcool.cn/community/01e75b5da933daa801209e1ffa4649.jpg@1280w_1l_2o_100sh.jpg'
|
||||
|
||||
import logo from "./images/logo_w.png"
|
||||
|
||||
@Entry
|
||||
class ImageDemo extends Panel {
|
||||
build(rootView: Group): void {
|
||||
@@ -124,7 +127,16 @@ class ImageDemo extends Panel {
|
||||
right: 0.149,
|
||||
bottom: 0
|
||||
}
|
||||
})
|
||||
}),
|
||||
label('Asset Image'),
|
||||
image({
|
||||
imageBase64: logo,
|
||||
width: 235,
|
||||
height: 235,
|
||||
backgroundColor: Color.BLACK,
|
||||
scaleType: ScaleType.ScaleAspectFill,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
}),
|
||||
],
|
||||
{
|
||||
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT),
|
||||
|
4
doric-demo/src/image.d.ts
vendored
Normal file
4
doric-demo/src/image.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
declare module '*.png' {
|
||||
const value: any;
|
||||
export default value;
|
||||
}
|
BIN
doric-demo/src/images/logo_w.png
Normal file
BIN
doric-demo/src/images/logo_w.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Reference in New Issue
Block a user