vueテンプレート文字列の書き方

2532 ワード

1、テンプレート文字列接合id
<div class="thumbnail" :id="`ctrol_${item.id}`">
    <i :class="'icon iconfont ' + item.icon">i>
div>

効果
id="ctrol_1"
<div :style="{width: `${data.width}px`,height:`${data.height}px`,background:`red`}">
        <canvas
            ref="canvas"
            class="elem-container"
            :width="canvasWidth"
            :height="canvasHeight"
            :style="assignStyle"
        />
  div>

テンプレート文字列2
<div :style="'left:'+myOptions.getPosition()+'px;top:'+myOptions.getPosition()+'px'">

div>