vue中改變滾動(dòng)條樣式的方法
寫(xiě)在前面: 我是 揚(yáng)帆向海,這個(gè)昵稱來(lái)源于我的名字以及女朋友的名字。我熱愛(ài)技術(shù)、熱愛(ài)開(kāi)源、熱愛(ài)編程。技術(shù)是開(kāi)源的、知識(shí)是共享的。
這博客是對(duì)自己學(xué)習(xí)的一點(diǎn)點(diǎn)總結(jié)及記錄,如果您對(duì) Java、算法 感興趣,可以關(guān)注我的動(dòng)態(tài),我們一起學(xué)習(xí)。
用知識(shí)改變命運(yùn),讓我們的家人過(guò)上更好的生活。
今天在自己開(kāi)發(fā)的一個(gè)項(xiàng)目中,需求是讓瀏覽器的滾動(dòng)軸變細(xì)。想了好長(zhǎng)時(shí)間才完成,在目前的測(cè)試中,滾動(dòng)條在IE瀏覽器中不支持。
scrollbar.css
@charset 'utf-8';::-webkit-scrollbar { width: 5px; } /*定義滾動(dòng)條軌道 內(nèi)陰影+圓角*/ ::-webkit-scrollbar-track { border-radius: 10px; background-color: rgba(0,0,0,0.1); } /*定義滑塊 內(nèi)陰影+圓角*/ ::-webkit-scrollbar-thumb { border-radius: 10px; -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3); background-color: rgba(0,0,0,0.1);}
在 index.html中引入樣式
<link rel='stylesheet' href='http://www.intensediesel.com/bcjs/static/css/scrollbar.css' rel='external nofollow' >
方法二
1. 首先需要先下載我們所需要的模塊,這里我用的是“vuescroll”
//老規(guī)矩,先安裝模塊 npm install vuescroll
2. 在項(xiàng)目中進(jìn)行導(dǎo)入
//main.js import vuescroll from ’vuescroll’; import ’vuescroll/dist/vuescroll.css’; Vue.use(vuescroll);
3. 引入(瀏覽器環(huán)境)
<!-- html --><script src='https://unpkg.com/vue'></script><script src='https://unpkg.com/vuescroll'></script><!-- 引入vuescroll-slide --><script src='https://unpkg.com/vuescroll/dist/vuescroll-slide.js'></script><!-- 引入vuescroll-native --><script src='https://unpkg.com/vuescroll/dist/vuescroll-native.js'></script><link rel='stylesheet' type='text/css' rel='external nofollow' />
4. 使用
<!-- 組件的模板 --><template> <div class=’your-container’> <!-- bind your configurations --> <vue-scroll :ops='ops' style='width:200px;height:100px'><ul class=’your-content’> <li>dsfdsfdfg</li> <li>dsfdsfdfg</li> <li>dsfdsfdfg</li> <li>dsfdsfdfg</li> <li>dsfdsfdfg</li> <li>dsfdsfdfg</li> <li>dsfdsfdfg</li> <li>dsfdsfdfg</li> <li>dsfdsfdfg</li> <li>dsfdsfdfg</li> <li>dsfdsfdfg</li> <li>dsfdsfdfg</li></ul> </vue-scroll> </div></template><!-- 組件的模型 --><script> export default { // 組件的名稱 name: 'car', data() { return {ops: { vuescroll: {}, scrollPanel: {}, rail: { keepShow:true }, bar: { hoverStyle: true, onlyShowBarOnScroll: false, //是否只有滾動(dòng)的時(shí)候才顯示滾動(dòng)條 background: ’red’, }}, } }, }</script>
到此這篇關(guān)于vue中改變滾動(dòng)條樣式的方法的文章就介紹到這了,更多相關(guān)vue 改變滾動(dòng)條樣式內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!
相關(guān)文章:
1. JavaWeb Servlet中url-pattern的使用2. ASP中格式化時(shí)間短日期補(bǔ)0變兩位長(zhǎng)日期的方法3. asp知識(shí)整理筆記4(問(wèn)答模式)4. 怎樣才能用js生成xmldom對(duì)象,并且在firefox中也實(shí)現(xiàn)xml數(shù)據(jù)島?5. javascript xml xsl取值及數(shù)據(jù)修改第1/2頁(yè)6. ASP實(shí)現(xiàn)加法驗(yàn)證碼7. XML解析錯(cuò)誤:未組織好 的解決辦法8. 小技巧處理div內(nèi)容溢出9. js的一些潛在規(guī)則使用分析10. ASP刪除img標(biāo)簽的style屬性只保留src的正則函數(shù)
