• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

Recommended Posts

1.延伸

使用基本的Vue构造函数创建子类。

div #装载点

//数据必须是函数。

var peofile=Vue.extend({

模板:“”

数据:函数(){}

})

//创建一个配置文件实例,并将其挂在to元素上。

新建个人资料()。$ mount(# mount-point)

2.vue . next tick([回调,上下文])

使用此方法可以在修改数据后立即获取更新的DOM。

异步更新队列

VUe异步更新dom。只要感知到数据变化,Vue就会打开一个队列,缓冲同一时间周期内发生的数据变化。如果watcher被多次书写,它只会被推入队列一次。为了在数据变更后等待Vue完成更新,可以在数据变更后立即使用Vue.nextTick(callback),在DOM更新后会调用回调函数。

使用该组件特别方便。组件中的$nextTick()。它不需要全局Vue,回调函数中的这个自动绑定到当前的Vue实例。

这个。$nextTick()

$nextTick返回一个Promise对象,该对象可以使用async和await。

methods : { update message : function(){

This.message='已更新'

Console.log(这个。$ el.textcontent)//='未更新'

这个。$nextTick(函数()

{console.log (this。$ el.textcontent)//=' updated'})

}

methods : { update message :异步函数()

{this.message=' updated '

Console.log(这个。$ el.textcontent)//='未更新'

等待这个。$nextTick()

Console.log(这个。$ el.textcontent)//=' updated'}

}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now