在描述下的app.js中添加任何html代码时,页面仅显示以前的文本,而不显示html代码: 我在下面添加了使用document.getElemen,document.write等的代码。 我想做的是,当产品被单击附加在Firebase代码上的代码时,显示带有时间和日期的表列表 例如:database.ref(“ 0 /” + id +“ /”)
// Dom7
var $$ = Dom7;
// Framework7 App main instance
var app = new Framework7({
root: '#app', // App root element
id: 'io.framework7.testapp', // App bundle ID
name: 'Framework7', // App name
theme: 'auto', // Automatic theme detection
// App root data
data: function () {
return {
user: {
firstName: 'John',
lastName: 'Doe',
},
// Demo products for Catalog section
products: [
{
id: '1',
title: 'January',
description: '<table id="prayer_timetable"> </table>'
},
{
id: '2',
title: 'February',
description: '.'
},
{
id: '3',
title: 'March',
description: '.'
},
{
id: '1',
title: 'January',
description: '.'
},
{
id: '2',
title: 'February',
description: '.'
},
{
id: '3',
title: 'March',
description: '.'
},
{
id: '1',
title: 'January',
description: '.'
},
{
id: '2',
title: 'February',
description: '.'
},
{
id: '3',
title: 'March',
description: '.'
},
{
id: '1',
title: 'January',
description: '.'
},
{
id: '2',
title: 'February',
description: '.'
},
{
id: '3',
title: 'March',
description: '.'
},
{
id: '2',
title: 'Jumma',
description: '.'
},
{
id: '3',
title: 'Ramadan',
description: '.'
},
]
};
},
// App root methods
methods: {
helloWorld: function () {
app.dialog.alert('Hello World!');
},
},
// App routes
routes: routes,
});
// Init/Create views
var homeView = app.views.create('#view-home', {
url: '/'
});
var catalogView = app.views.create('#view-catalog', {
url: '/catalog/'
});
var settingsView = app.views.create('#view-settings', {
url: '/settings/'
});
// Login Screen Demo
$$('#my-login-screen .login-button').on('click', function () {
var username = $$('#my-login-screen [name="username"]').val();
var password = $$('#my-login-screen [name="password"]').val();
// Close login screen
app.loginScreen.close('#my-login-screen');
// Alert username and password
app.dialog.alert('Username: ' + username + '<br>Password: ' + password);
});
//prayer timetable
var database = firebase.database();
database.ref("0/13/").on('value', function(snapshot){
if(snapshot.exists()){
var content = '';
snapshot.forEach(function(data){
var val = data.val();
content +='<tr>';
content += '<div id="corner"> <td>' + val.bmm_donations + '</td> </div>';
content += '</tr>';
});
$('#prayer_timetable').append(content);
}
});