我希望在后端存储一些内容,其中包含带有样式的标记组件的混合。当呈现以下内容时,我只是得到'
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from .models import Project
@login_required(login_url='/accounts/login/')
def projectsWorkers(request):
user = request.user
user_projects = Project.objects.filter(worker=user).order_by('deadline')
template = 'projects/projects-worker-home.html'
return render(request, template, {'user_projects': user_projects, 'user': user})
如何将标记字符串呈现或评估为代码?
答案 0 :(得分:0)
这可能有帮助
let fromDb = '<Text style={{color:"#f00"}}>Hello World</Text>';
return (
<View style={styles.container}>
{fromDb}
</View>
)