<p><el-input v-model="query.oid"  readonly class="centered"></el-input></p>
<style>
.centered {
  text-align: center;
}
</style>
<p>您可以使用CSS样式来实现文本内容居中。在el-input的外层元素上添加一个样式类,并设置该元素的text-align属性为center即可。</p>
<p>示例代码如下:</p>
<pre><code class="language-html">&lt;el-input v-model=&quot;query.oid&quot; readonly class=&quot;centered&quot;&gt;&lt;/el-input&gt;
</code></pre>
<pre><code class="language-css">.centered {
  text-align: center;
}
</code></pre>
<p>这样设置之后,el-input中的文本内容就会居中显示了。</p>
Element UI el-input文本内容居中显示方法

原文地址: https://www.cveoy.top/t/topic/qz13 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录