【Web】<script type="text/template"></script>适合用于定义模板(模板容器),不解析(渲染/执行)

博客介绍了 <script type='text/template'> 标签适合用于定义模板,且该标签内容不会被解析、渲染或执行,在 Web 开发中有一定作用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

             
<template> <view class="lime-painter" ref="limepainter"> <view v-if="canvasId && size" :style="styles"> <!-- #ifndef APP-NVUE --> <canvas class="lime-painter__canvas" v-if="use2dCanvas" :id="canvasId" type="2d" :style="size"></canvas> <canvas class="lime-painter__canvas" v-else :canvas-id="canvasId" :style="size" :id="canvasId" :width="boardWidth * dpr" :height="boardHeight * dpr"></canvas> <!-- #endif --> <!-- #ifdef APP-NVUE --> <web-view :style="size" ref="webview" src="/uni_modules/lime-painter/static/index.html" class="lime-painter__canvas" @pagefinish="onPageFinish" @error="onError" @onPostMessage="onMessage"> </web-view> <!-- #endif --> </view> <slot /> </view> </template> <script> import { parent } from '../common/relation' import props from './props' import {toPx, base64ToPath, pathToBase64, isBase64, sleep, getImageInfo}from './utils'; // #ifndef APP-NVUE import { compareVersion } from './utils'; import Painter from './painter' // import Painter from '@lime/' const nvue = {} // #endif // #ifdef APP-NVUE import nvue from './nvue' // #endif export default { name: 'lime-painter', mixins: [props, parent('painter'), nvue], data() { return { // #ifdef MP-WEIXIN || MP-TOUTIAO || MP-ALIPAY use2dCanvas: true, // #endif // #ifndef MP-WEIXIN || MP-TOUTIAO || MP-ALIPAY use2dCanvas: false, // #endif canvasHeight: 150, canvasWidth: null, parentWidth: 0, inited: false, progress: 0, firstRender: 0, done: false }; }, computed: { styles() { return `${this.size}${this.customStyle||''};` }, canvasId() { return `l-painter${this._uid || this._.uid}` }, size() { if (this.boardWidth && this.boardHeight) { return `width:${this.boardWidth}px; height: ${this.boardHeight}px;`; } }, dpr() { return this.pixelRatio || uni.getAppBaseInfo().pixelRatio; //todo ivan getSystemInfoSync }, boardWidth() { cons
03-14
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值