Snowpack多页面应用程序,带有svelte和tailwindcsss

问题描述

我能够部分设置汇总+ svelte +顺风+多页,但是它的速度慢且调试困难。

尽管这里有苗条的雪地+积雪的雪+尾风https://github.com/agneym/svelte-tailwind-snowpack

但是我无法弄清楚多页雪花包。 我什至找不到任何有关多页雪花包设置的文档。

有人可以帮助我弄清楚如何设置Snowpack + Svelte + 多页 + Tailwind-css吗?

解决方法

snowpack.config.mjs:

package com.example.android.writedown;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.util.List;

public class NoteAdapter extends ArrayAdapter<NoteItem> {
    public NoteAdapter(@NonNull Context context,@NonNull List<NoteItem> notes) {
        super(context,notes);
    }

    @NonNull
    @Override
    public View getView(int position,@Nullable View convertView,@NonNull ViewGroup parent) {
        View listItemView = convertView;
        if(listItemView == null) {
            listItemView = LayoutInflater.from(getContext()).inflate(R.layout.note_list_item,parent,false);
        }

        NoteItem currNote = getItem(position);
        String title = currNote.getTitle();
        String desc = currNote.getNote();
        TextView note_title = (TextView) listItemView.findViewById(R.id.note_title);
        TextView note_desc = (TextView) listItemView.findViewById(R.id.note_description);

        if(title!=null) {
            note_title.setText(title);
            note_title.setVisibility(View.VISIBLE);
        }

        if(desc!=null) {
            note_desc.setText(desc);
            note_desc.setVisibility(View.VISIBLE);
        }

        return listItemView;
    }
}

因此,<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:id="@+id/note_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:textStyle="bold" android:fontFamily="sans-serif" android:visibility="invisible"/> <TextView android:id="@+id/note_description" android:layout_width="match_parent" android:layout_height="wrap_content" android:fontFamily="sans-serif" android:visibility="invisible"/> </LinearLayout> 中的所有文件都将编译为 export default { mount: { public: "/",src: "/dist" },...

src中,设置另一个与dist完全相同的/src(如果您愿意,您只能更改导入路径)。

page.js 中导入的 index.js 将作为除 Page.svelte 之外的另一条路线。

page.js中:

注意 index 中的 /public 标签: <script>

现在,创建另一个 index.html,但使用新的 <script type="module" src="/dist/index.js"></script>/public/page.html

而且,它。您有一条新的 page.js 路线。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...