I'm creating an Arabic website with 'Vue.js', and I use iView for UI components, but the problem is that it's designed for LTR layouts while Arabic is RTL. How can I convert iView components to RTL??

Example: I want to make the search button in the input field on the left in this website "it's now on the right"

解决方案

You could simply use dir='rtl' attribute like <i-input dir="rtl" .../> but the problem is with the search button which will not fit appropriately, so to fix that add some CSS rules like i did in the following working example :

var Main = {

}

var Component = Vue.extend(Main)
new Component().$mount('#app')
@import url("//unpkg.com/iview/dist/styles/iview.css");
#app {
  padding: 32px;
}



.ivu-input-group-append,
.ivu-input-group>.ivu-input:last-child {
  border-radius: 4px 0 0 4px!important;
 
}
.ivu-input-search::before{
width:0;
}
<script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="//unpkg.com/iview/dist/iview.min.js"></script>
<div id="app">
  <div>
    <i-input search enter-button search placeholder="ابحث عن طريق الإسم أو المدينة" dir="rtl" />

  </div>
</div>

这篇关于Vue.js - 如何在 RTL 方向使用 iView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 20:31