polymer icon indicating copy to clipboard operation
polymer copied to clipboard

How to pass parameter to dom-module

Open hexiaoting opened this issue 4 years ago • 2 comments

index.html:

<!DOCTYPE html>
<html>
<head>
    <script src="./deps/webcomponentsjs/webcomponents-lite.js"></script>
    <link rel="import" href="./check_base.html">
</head>
<body>
    <dashboard _srcMode=6 mood="happy"></dashboard>
</body>
</html>

check_base.html:

<link rel="import" href="./deps/polymer/polymer.html">
<dom-module id="dashboard">
<template>
	<p class="sidebar"> this is a test</p>
	<div > dfsafsa {{_srcMode}} [[mode]]</div>
<style>
.sidebar {
  display: flex;
  height: 100%;
	color:red;
}
</style>
</template>
</dom-module>

<script>
Polymer({
  is: 'dashboard',
  properties: {
    _srcMode:{
      type: Number,
      value: 10,
      observer: '_selectedModeChanged'
    },
    mood: String,
  },
	load: function() {
		console.log("loading");
	},
	created: function() {
		console.log("created");
		console.log("value=" + this.mood);
		this.mood="mmmm";
	},
        _selectedModeChanged: function() {
		console.log("_selectedModeChanged");
       }
});

</script>

But when I access index.html, value is not passed: image

hexiaoting avatar May 12 '20 10:05 hexiaoting

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 02 '21 16:06 stale[bot]

can we not contribute to this anymore?

uniiquecornnx avatar Jul 16 '23 11:07 uniiquecornnx