element directives
• custom directivesͱͷҧ͍
1. argͱexpressionड͚ೖΕෆՄ
https://jsfiddle.net/kazupon/gv9wLL94/10/
current view : view1
# element directive ͷҾͷ༰
name: {{name}}
arg: {{arg}}
expression: {{expression}}
raw: {{raw}}
new Vue({
data: { view: ‘view1' },
elementDirectives: {
view: {
bind: function () {
var self = this
this.vm.$set('arg', this.arg) //
undefined
this.vm.$set('expression',
this.expression) // “”
this.vm.$set('raw', this.raw) // “”
this.vm.$set('name', this.name) // view
this._watcher = this.vm.$watch('view',
function (val, old) {
self.update(val, old)
})
},
...