1. 程式人生 > >vue的跑馬燈效果製作

vue的跑馬燈效果製作

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>跑馬燈效果</title>
    <script src="vue.js"></script>
</head>
<body>
    <!--容器-->
    <div id="app">
        <input type="button" value="浪起來" @click="lang">  //點選事件繫結
        <h4>{{ msg }}</h4>
    </div>
<script>
    // 建立一個vue例項
    var vm=new Vue({
        el:'#app',  // 繫結id為appid容器
        data:{
            msg:'啊啊啊啊啊啊啊啊------'
        },
        methods:{
            lang(){
                _this=this   //將this給到_this然後傳入函式內
                setInterval(function () {  //定時任務
                    console.log(_this.msg);
                    var first=_this.msg.substring(0,1);
                    var end=_this.msg.substring(1);
                    _this.msg=end+first;
                },50);
            }
        }
    })
</script>
</body>
</html>

效果:字再往左邊跑,不想下gif錄製軟體了,所以口頭說明吧

相關推薦

vue馬燈效果製作

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>跑馬燈效果</title> <sc

Vue馬燈效果(es5)

<div id="app"> <button @click="go">走</button> <button @click="stop">停</button> <h3> {{msg}} </h3>

vue文字馬燈效果

star lis using obia dir ng- visible tick cdn https://cdn.bootcss.com/jQuery.Marquee/1.5.0/jquery.marquee.js 兼容vue $("#demo4").marquee({

VUE之文字馬燈效果

文字 utf button doctype put inpu stop title set <!DOCTYPE html> Title <input type="button" value="浪起來"

Vue 文字馬燈效果

1. 話不多說 看程式碼 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title>

VUE 回車換行提交表單 馬燈效果 只允許文字框中輸入0-9數字

匯入vue.js <script src="vue-2.5.17.js"></script> 1.回車換行 提交表單 <div id="app"> <input type="text" v-model=

簡單的馬燈效果(輪播圖)

font script meta 圖片 ive abs height 單單 none 邏輯簡介:想要圖片或者是文字向左移動,那肯定得用到定時器,那麽移動那就必然是距離左邊的left值在改變;核心問題就是通過定時器來改變ul距離left的值;本姑娘就是簡簡單單直直接接,上代碼

Android 開發筆記___textvieww__馬燈效果

support ota 效果 utf bundle per ack top ddl 1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://sche

TextView的馬燈效果(AS開發實戰第二章學習筆記)

color clas eat star log ble _for ellipsize ddl TextView的跑馬燈效果跑馬燈用到的屬性與方法說明singleLine 指定文本是否單行顯示ellipsize 指定文本超出範圍後的省略方式focusable 指定是否獲得焦點

TextView的馬燈效果

焦點 包括 效果 avi gpo textview 跑馬燈 nbsp lips TextView的gravity屬性可以指定文本的對齊方式 跑馬燈的實現: 1.singleLine設置為true 2.ellipsize(文本超出後的省略方式,包括start、middle

Android RecyclerView一個一個自動滾動,無限迴圈,聊天列表效果馬燈效果

實現效果 看到這個效果,看到很多人用ViewFlipper實現,但是效果並不理想,於是我想到用RecyclerView試試。 主要是監聽recyclerView滑動,開始和暫停來控制,廢話不多說,上程式碼。 自定義RecyclerView public class Auto

小程式實現馬燈效果

跑馬燈效果比較常見,一般做電商類的小程式都會使用到; 跑馬燈效果的製作 製作方式很簡單,先方上程式碼,後面會對程式碼詳細講解 一、wxml介面的實現 <view class="example"> <view class="marquee_box">

TextView 馬燈效果一個佈局可用多個效果

public class TextMarquee extends TextView { public TextMarquee(Context context, AttributeSet attrs) { super(context, attrs); } @Override protec

簡單實現馬燈效果

先看看效果 在build.gradle中匯入依賴 implementation ‘com.sunfusheng:marqueeview:1.3.3’ 佈局檔案 <?xml version="1.0" encoding="utf-8"?> <androi

微信小程式:公告字幕滾動播放(文字馬燈效果

一、需求 公告文字僅限200字 公告內容僅限一行文字顯示 公告內容持續滾動 二、解決思路 使用動畫API(Animation.translate),完成移動動畫 使用定時器API(setInterval),完成迴圈播放動畫 注

微信小程式-文字馬燈效果

效果如圖 WXML <scroll-view class="container"> <view class="scrolltxt"> <view class="marquee_box"> <view class=

簡單實現TextVIew馬燈效果

<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="莫聽穿林打葉聲,何妨吟嘯且徐行。竹杖芒鞋輕勝馬,誰怕?一蓑煙雨任平生。 "

Android 實現馬燈效果

這裡用到了HorizontalScrollView巢狀TextView,上xml佈局: <HorizontalScrollView android:id="@+id/horiSv" android:layout_width="match_parent"

Android-TextView馬燈效果

1.讓很多文字一行顯示,預設是false,設定為true; android:singleLine="true" 2.對文字進行裁剪,預設是end裁剪; android:ellipsize="end"    3.設定文字裁剪為start,設定一行顯示:

微信小程式實現馬燈效果(完整程式碼)

在微信小程式 裡實現跑馬燈效果,類似滾動字幕或者滾動廣告之類的,使用簡單的CSS樣式控制,沒用到JS,效果如下圖: Wxml程式碼: <!--跑馬燈 Linyufan.com--> <view class="marquee_container" st