New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

c-poster

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

c-poster

分享海报,商品海报,推广海报...

latest
npmnpm
Version
1.0.0
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source

欢迎使用 c-poster

npm下载量:downloads

注意:微信小程序需要添加download域名白名单

安装

// npm安装方式,插件市场导入无需执行此命令。插件市场导入地址:https://ext.dcloud.net.cn/plugin?name=c-poster
npm install c-poster

使用方法

<template>
	<view class="poster">
		<c-poster
			ref="cPoster"
			:canvas-style="poster.style"
			:views="poster.views"
			@success="onSuccess"
		/>
	</view>
</template>

<script>
// 以下导入方式按照安装方式导入,二选一
// 插件市场导入方法:无需引入,可直接使用
// npm导入方法如下:
import cPoster from "c-poster/components/c-poster/c-poster.vue";
export default {
	// npm导入需要添加components,插件市场导入不需要
	components: {
	    cPoster
	},
	data() {
		return {
			poster: {
				style: {
					width: "200px",
					height: "300px"
				},
				views: [
					{
						type: "image",
						path: "https://img.alicdn.com/bao/uploaded/i3/2367364052/O1CN01EzU66N1fnrf4MBEwh_!!0-item_pic.jpg_460x460q90.jpg_.webp",
						x: 0,
						y: 0,
						width: 200,
						height: 200
					},
					{
						type: "text",
						content: "测试内容",
						x: 10,
						y: 210
					}
				]
			}
		}
	},
	onReady() {
		// 模仿接口请求
		setTimeout(() => {
			this.$refs.cPoster.init();
		}, 200)
	},
	methods: {
		onSuccess(filePath) {
			// filePath:uni.canvasToTempFilePath成功回调返回的文件路径
		}
	}
}
</script>

API

Props

参数说明类型默认值可选值
canvas-stylecanvas标签的样式Object--
views绘画canvas的内容Array--

views,type为image的参数说明

参数说明类型默认值可选值
type类型:图片Stringimage-
path图片路径,支持网络图片和本地图片,本地图片地址示例:/static/logo.pngString--
x单位px,图片x轴位置(图片距离canvas左边的距离)Number--
y单位px,图片y轴位置(图片距离canvas顶部的距离)Number--
width单位px,图片宽度Number--
height单位px,图片高度Number--
radius单位px,图片圆角Number--

views,type为text的参数说明

参数说明类型默认值可选值
type类型:文本Stringtext-
content在画布上输出的文本String--
x单位px,文字x轴位置(文字距离canvas左边的距离)Number--
y单位px,文字y轴位置(文字距离canvas顶部的距离)Number--
fontSize单位px,字体大小Number--
font同css的font属性String--
color字体颜色String--

Events

事件名说明回调参数
successcanvas绘画成功回调filePath

Keywords

分享海报

FAQs

Package last updated on 26 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts