Skip to content

Commit

Permalink
fix: <fixed issue #25 Can't assign a base variable to input attribute…
Browse files Browse the repository at this point in the history
… with a component>
  • Loading branch information
Jake.Zheng authored and Jake.Zheng committed Sep 4, 2018
1 parent 6f33759 commit e387faf
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 16 deletions.
28 changes: 28 additions & 0 deletions demo/components/comp5.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<uku-component>
<template>
<div></div>
</template>
<script>
(function(){
return function(uku){
Object.defineProperty(this, 'itemValue', {
set:function(value){
if(value){
this.myItemValue = value;
console.log(this.myItemValue);
}
}
});

Object.defineProperty(this, 'itemValue2', {
set:function(value){
if(value !== undefined){
this.myItemValue2 = value;
console.log(this.myItemValue2);
}
}
})
}
})();
</script>
</uku-component>
22 changes: 8 additions & 14 deletions demo/native.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,21 @@
</head>

<body uku-application>
<!--<my-comp id="myComp"></my-comp>
<button uku-onclick="myCtrl.clickHandler('test',1)">test me</button>
<my-item uku-render="myCtrl.show"></my-item>-->
<!--<my-comp2 show-input="myCtrl.show"></my-comp2>-->
<!--<select uku-selected="myCtrl.selectedItem|value">
<option uku-repeat="item in myCtrl.items" uku-data-item="item" uku-value="item.value">{{item.name}}</option>
</select>-->
<!-- <my-comp3 uku-options="myCtrl.options" uku-login-user="myCtrl.loginUser"></my-comp3> -->
<!-- <button uku-onclick="myCtrl.done()">done</button> -->
<my-comp3 uku-onclickhandler="myCtrl.clickHandler()"></my-comp3>
<button uku-disabled="!myCtrl.disabled">button</button>
<input type="password" uku-value="myCtrl.password">
<p>{{myCtrl.password}}</p>
<my-comp5 uku-item-value="99 + myCtrl.number" uku-item-value2="myCtrl.show"></my-comp5>
<div>
{{999}}
</div>
</body>
<script>
var uku = new Ukulele();
uku.registerController('myCtrl',new MyCtrl(uku));
//uku.registerComponent('my-comp2',"components/comp2.html");
//uku.registerComponent('my-comp',"components/comp1.html");
//uku.registerComponent('my-item',"components/my_item.html");
uku.registerComponent('my-comp3','components/comp3.html');
//uku.registerComponent('my-comp3','components/comp3.html');
//uku.registerComponent('my-comp4','components/comp4.html');
uku.registerComponent('my-comp5','components/comp5.html');

uku.init();

function MyCtrl(uku){
Expand All @@ -43,6 +36,7 @@
}
this.disabled = false;
this.show = false;
this.number = 1;
this.loginUser = {};
this.options = [];
this.done = function(){
Expand Down
2 changes: 1 addition & 1 deletion dist/uku.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/uku.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/core/Analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ export class Analyzer extends EventEmitter {
});

boundItem.render(controllers);
}else{
//native value, not expression
let boundItem = new BoundItemComponentAttribute(attr.nodeValue, tagName, cc, this.uku);
boundItem.render([]);
}
}
}
Expand Down

0 comments on commit e387faf

Please sign in to comment.