Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromvuejs/vue

Commiteca73f2

Browse files
defccyyx990803
authored andcommitted
fix directive sort compare (vuejs#3776)
* fix directive sort compare* fix directive sort compare. and update normal directives test case.
1 parent64f7113 commiteca73f2

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

‎src/compiler/compile.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,20 @@ function sortDirectives (dirs) {
122122

123123
vargroupedMap={}
124124
vari,j,k,l
125+
varindex=0
126+
varpriorities=[]
125127
for(i=0,j=dirs.length;i<j;i++){
126128
vardir=dirs[i]
127129
varpriority=dir.descriptor.def.priority||DEFAULT_PRIORITY
128130
vararray=groupedMap[priority]
129131
if(!array){
130132
array=groupedMap[priority]=[]
133+
priorities.push(priority)
131134
}
132135
array.push(dir)
133136
}
134137

135-
varindex=0
136-
varpriorities=Object.keys(groupedMap).sort(function(a,b){
138+
priorities.sort(function(a,b){
137139
returna>b ?-1 :a===b ?0 :1
138140
})
139141
for(i=0,j=priorities.length;i<j;i++){

‎test/unit/specs/compiler/compile_spec.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ describe('Compile', function () {
5353
it('normal directives',function(){
5454
el.setAttribute('v-a','b')
5555
el.innerHTML='<p v-a:hello.a.b="a" v-b="1">hello</p><div v-b.literal="foo"></div>'
56-
vardefA={priority:1}
57-
vardefB={priority:2}
56+
vardefA={priority:250}
57+
vardefB={priority:1100}
5858
varoptions=_.mergeOptions(Vue.options,{
5959
directives:{
6060
a:defA,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp