forked from vuejs/vue
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- support multiple mustache tags - support filters - support arbitrary expression - support explicit one-way binding syntax {{*parentKey}} - non-settable expressions are automatically one-way
- Loading branch information
Showing
11 changed files
with
145 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
var _ = require('../util') | ||
|
||
/** | ||
* Apply a filter to a list of arguments. | ||
* This is only used internally inside expressions with | ||
* inlined filters. | ||
* | ||
* @param {String} id | ||
* @param {Array} args | ||
* @return {*} | ||
*/ | ||
|
||
exports._applyFilter = function (id, args) { | ||
var registry = this.$options.filters | ||
var filter = registry[id] | ||
_.assertAsset(filter, 'filter', id) | ||
return (filter.read || filter).apply(this, args) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
var Vue = require('../../../../src/vue') | ||
|
||
describe('misc', function () { | ||
|
||
it('_applyFilter', function () { | ||
var vm = new Vue({ | ||
filters: { | ||
a: { | ||
read: function (a, b) { | ||
return a + b | ||
} | ||
}, | ||
b: function (a, b) { | ||
return a - b | ||
} | ||
} | ||
}) | ||
expect(vm._applyFilter('a', [1, 1])).toBe(2) | ||
expect(vm._applyFilter('b', [1, 1])).toBe(0) | ||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters