美文网首页微信小程序
转载-微信小程序-引用

转载-微信小程序-引用

作者: 一曲广陵散 | 来源:发表于2016-11-08 10:27 被阅读20次

wxml提供两种文件引用方式import ,include

一 import

import 可以在该文件中使用目标文件定义的template,
比如: 在item.wxml 中定义了一个叫 item的template
import(1).png
在index.wxml中引用了item.wxml,可以用item模板
import(2).png

二 import的作用域

import有作用域的概念,
只会import目标文件中定义的template
不会import目标文件import的template
import 作用域.png

三 Include

include可以将目标文件除了<template/>的整个代码引入
相当于是将模板中代码复制到include位置
include.png

相关文章

网友评论

    本文标题:转载-微信小程序-引用

    本文链接:https://www.haomeiwen.com/subject/wwjauttx.html