test.js 891 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //Component Object
  2. Component({
  3. options: {
  4. styleIsolation: 'isolated'
  5. },
  6. properties: {
  7. msg:{
  8. type:String,
  9. value:'',
  10. observer(a,b){
  11. console.log('msg changed: ', a, b);
  12. this.setData({
  13. name: Math.random()
  14. })
  15. }
  16. },
  17. },
  18. data: {
  19. name: 'Thanos'
  20. },
  21. methods: {
  22. log(){
  23. console.log('I am logger', this.properties.msg)
  24. this.triggerEvent('childEvent', new Date().getTime())
  25. },
  26. },
  27. observers:{
  28. name: function(a){
  29. console.log('name changed', a);
  30. }
  31. },
  32. created: function(){
  33. console.log('component created');
  34. },
  35. attached: function(){
  36. console.log('component attached');
  37. },
  38. ready: function(){
  39. console.log('component ready');
  40. },
  41. moved: function(){
  42. console.log('component moved');
  43. },
  44. detached: function(){
  45. console.log('component detached');
  46. },
  47. });